3 ms·
Both solve state management issues, but really different goals. Unstated has state containers as separate entities. This one is about seamlessly switching from
by ricardobeat 8y ago
Both solve state management issues, but really different goals.
Unstated has state containers as separate entities. This one is about seamlessly switching from a local useState hook to a context-based one with minimal code changes.
I’m not convinced it’s worth the hassle vs just creating your own contexts though. Here is the full source: https://github.com/diegohaz/constate/blob/master/src/index.tsx https://github.com/diegohaz/constate/blob/master/src/index.t...
- rckclmbr 8y ago> I’m not convinced it’s worth the hassle vs just creating your own contexts though This is what I was thinking when running through the source. The problem to solve, I think, is to get rid of the providers. Or rather, make it less jsxy. For application-level contexts, you can easily have 10+ providers at the root of the application. You could make them HOCs, but that's still super ugly. Hooks made the consumer side a lot cleaner, now it's time to do something about the provider.