Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Seems to solve a similar issue as https://github.com/jamiebuilds/unstated


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.t...


> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: