Just use this inside the setFilteredProducts for filtering
products.filter((product)=>product.inStock)
If you want to filter the items depending on the value of inStock you should use .filter() like so:
products.filter(product => product.inStock === true)
Here product represents an element of products, which in your case is an object, and like any object you can access the properties inside using the dot accessor '.'