Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from "react";
- import { Link } from "react-router-dom";
- import { connect } from "react-redux";
- import { carOfferListFetched } from "../actions";
- const AdvertList = () => {
- return (
- <div>
- {!this.props.carOfferList && this.props.carOfferList.length == 0 && <div> Ładowanie </div> }
- {this.props.carOfferList && this.props.carOfferList.length > 0 && this.props.carOfferList.map(x => (
- <span>
- <Link to={`/advert/${x.title}`} className="Media__Link">
- <div>{x.producentName} {x.modelName} </div>
- </Link>
- <div>{x.shortDescription} </div>
- </span>
- ))
- }
- </div>
- );
- };
- export default AdvertList;
- const mapStateToProps = (state) => {
- return {
- carOfferList: state.carOfferList
- }
- };
- const mapDispatchToProps = { carOfferListFetched };
- export const AdvertListContainer = connect(mapStateToProps, mapDispatchToProps)(AdvertList);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement