Ah, just as I thought: this is for a _very_ specific use case, and only it: when your state depends on some props, and you need to reset it when props change. And they are doing it by introducing an intermediate state, which they admit themselves is hard to understand and that most components shouldn’t need it either.

I wouldn't call it a replacement for many useEffects, it just eliminates a need for one very specific and relatively rare useEffect by introducing some complexity in another area.

It's more of a hack that most people will never need, and the price of a mistake is very high there.

--

--

Frontend architect, coder. Love solving problems, fixing things and writing in-depth tech articles: https://www.developerway.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nadia Makarevich

Frontend architect, coder. Love solving problems, fixing things and writing in-depth tech articles: https://www.developerway.com