0

I'm setting up a blog that has multiple filtering options, I've used this tutorial and got the basics working, however when I'm calling the filterState inside the filteredCollected fn its returning different values than what it's "supposed to".

Here is a codesandbox link https://codesandbox.io/s/keen-smoke-jbd1k1?file=/src/App.js:0-3161

Basically it works like this, when a user clicks on a category (can be multiple) it updates the filterState with the selected category to true, it then fires off another function that does the filtering and gets all the key's that equal true to filter from, this is where I'm getting a different value in the state ( filteredCollected() ).

Thanks

jahkoora
  • 58
  • 5
  • Solved using this thread. https://stackoverflow.com/questions/57847594/react-hooks-accessing-up-to-date-state-from-within-a-callback – jahkoora Nov 16 '22 at 02:47

0 Answers0