--

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.

--

--

No responses yet