Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from "react";
  2. import { Link } from "react-router-dom";
  3. import { connect } from "react-redux";
  4. import { carOfferListFetched } from "../actions";
  5. const AdvertList = () => {
  6.  
  7.   return (
  8.     <div>
  9.       {!this.props.carOfferList && this.props.carOfferList.length == 0 && <div> Ładowanie </div> }
  10.       {this.props.carOfferList && this.props.carOfferList.length > 0 && this.props.carOfferList.map(x => (
  11.         <span>
  12.           <Link to={`/advert/${x.title}`} className="Media__Link">
  13.             <div>{x.producentName} {x.modelName}  </div>
  14.           </Link>
  15.           <div>{x.shortDescription} </div>
  16.         </span>
  17.       ))
  18.       }
  19.     </div>
  20.   );
  21. };
  22.  
  23. export default AdvertList;
  24.  
  25.  
  26. const mapStateToProps = (state) => {
  27.   return {
  28.     carOfferList: state.carOfferList
  29.   }
  30. };
  31. const mapDispatchToProps = { carOfferListFetched };
  32.  
  33. export const AdvertListContainer = connect(mapStateToProps, mapDispatchToProps)(AdvertList);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement