Given a list of products and a list of filters, create a multi-filters buttons bar with a list of filters. If any of the filter is clicked, the list of products should change and reflect the appropriate products.
<MultipleFilters />
component that takes care of the entire page, including filters bar and products list.button
or a filter
is clicked, the products should change. For example, if Bags
are clicked, the products list should only show products that have a category of Bags
.items
array.Given to you is an items
file that has products with name
and category
attributes.
name: string
category: string
Click to reveal
Can you try using array methods like map, filter, and reduce to keep track of changing filters?
Click to reveal
You can use React hooks like useEffect()
to see if any button is clicked, or the state of active filters are changed.