Statement
On a React catalogue page the state is { query, category, sort } and the visible list is computed from the products, not kept in another state. Write visibleProducts(products, view): filter by category (unless it is "all"), by query (contained in name, case-insensitive, ignoring surrounding spaces) and sort by sort: "price-asc", "price-desc" or "name". Don't mutate the array you receive.