I have been attempting to sift through an array of data
retrieved from my API, but unfortunately, the data remains unfiltered. I suspect that it might be due to the way I implemented my method or perhaps my params
are not being returned correctly. Below are both of my code snippets. Any help would be greatly appreciated. Thank you.
Code snippet for filtering data:
const [catalogueArray, setCatalogueArray] = useState([])
useEffect(() => {
catalogueList()
}, [])
const catalogueList = () => {
const catalogue = data.filter(item => {
item.storeName === navigation.state.params.enteredStore
return { ...item }
})
setCatalogueArray(catalogue)
}
Code snippet for setting Params:
const handleSelectedStore = (name) => {
setSelectStore({ selectStore: name })
navigation.navigate('StoreCatalogue', { selectStore: name })
}