Untitled
unknown
plain_text
a year ago
441 B
1
Indexable
const finalList = products.reduce( (a,c) => { if(c.name.toLowerCase().indexOf(filterText.toLowerCase()) === -1) {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