News for hackers. Stuff that matters.
Re:React: You Might Not Need an Effect by cush on Thursday March 23, 2023 @10:11AM (#35275103)
I recommend you read the article again. Just because window.location changes outside scope doesn't mean that React would update the component when window.location changes just because you put it in a dependency array.

This is because props or state didn't change and the parent didn't rerender.

UseEffect dependencies aren't observables. You'd need to wire up an event listener on unload, hashChange, etc

https://stackoverflow.com/questions/58442168/why-useeffect-d...

There are no comments on this comment yet.