Untitled
user_9300599
javascript
a year ago
471 B
4
Indexable
const finalList = products.reduce( (a,c) => { if(!c.name.toLowerCase().includes(filterText.toLowerCase()) ) {return a} if(inStockOnly && !c.stocked) {return a} (a.lastCategory !== c.category) && a.output.push(<ProductCategoryRow category={c.category} key={c.category} />) a.output.push(<ProductRow product={c} key={c.name} />) a.lastCategory = c.category return a }, { lastCategory: null, output: [] } )
Editor is loading...
Leave a Comment