Quantcast
Channel: How to use react hook useEffect only once in my case? - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by HMR for How to use react hook useEffect only once in my case?

In fetchProducts you are mutating products and that's not a good idea try products = sortProducts([...products], sortBy); instead. If the initial value of state.filters is [] and the initial value of...

View Article



Answer by nithin for How to use react hook useEffect only once in my case?

If you want to handle all the logic in a single useEffect call, you can take out all the prop dependencies [filters, sortBy] from useEffect. useEffect(() => { //This runs all the time a component...

View Article

How to use react hook useEffect only once in my case?

I think my question for a while seems to be a duplicate but i guess it is not, i have checked many questions that have same title but with different case The problem is that i was forced to use react...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images