Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import React from "react";
import { connect } from "react-redux";
import ProductCard from "./ProductCard";
class ProductsList extends React.Component {
render() {
const list = this.props.products.map(element => (
<ProductCard
key={element.id}
src={element.images[0].src}
name={element.name}
price={element.price}
/>
));
return <div>{list}</div>;
}
}
const mapStateToProps = state => ({
products: state.products
});
export default connect(mapStateToProps)(ProductsList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.