Hi,
I have this array from an API.
here the structure
const store =
[
{category: "Sporting Goods", price: "$49.99", stocked: true, name: "Football"},
{category: "Sporting Goods", price: "$9.99", stocked: true, name: "Baseball"},
{category: "Sporting Goods", price: "$29.99", stocked: false, name: "Basketball"},
{category: "Electronics", price: "$99.99", stocked: true, name: "iPod Touch"},
{category: "Electronics", price: "$399.99", stocked: false, name: "iPhone 5"},
{category: "Electronics", price: "$199.99", stocked: true, name: "Nexus 7"}
]
Here my loop, I’m using props with React.js, I can retrieve the item, but I want to have the category to be unique and stay in function programming concept with pure function?
const productAll = this.props.productAll;
const faire = productAll
.map(item =>
<p key={ item.name.toString() }>
{item.category === 'Sporting Goods'}
</p>
)