DEV Community

loading...

Discussion on: How to make sure useEffect catches array changes

Collapse
iquirino profile image
Igor Quirino

JSON.stringify(data) will add extra processing...
Why not to just add a counter (setState(0)) and then increment it when object get changed?

Collapse
stephane profile image
Stephane Rangaya Author

How would you do this?

Collapse
nicklaswinger profile image
Nicklas Pouey-Winger • Edited

I assume by calling setLoadCount((prevState) => prevState + 1) or something like that :)

Thread Thread
iquirino profile image
Igor Quirino