
Show HN: Restatable – Simplify your global state in React - michaelwm1
https://github.com/michaelwm/restatable
======
michaelwm1
Developer here!

I’ve never been able to find just the right React state management framework.
I love Redux: I used it in the workplace on a large scale project and it made
development at scale manageable. I’ve also enjoyed createContext, Unstated,
and other state management libraries for projects at a smaller scale. But none
of these solutions (with one exception) actually fix the only reason I don’t
use Redux for small projects: they still require a lot of boilerplate!

That’s why I created Restatable, a library that actually simplifies global
state management in React. Inspired by the one library that fixed my problems
([https://github.com/cs01/stator](https://github.com/cs01/stator)), Restatable
lets you keep using React state the way you always have but makes global state
manageable. There is no boilerplate to write or new frameworks to learn. Hell,
even the syntax is the same. If you know React, you already know Restatable.

To use Restatable, you just:

1\. Create a Restatable store.

2\. Connect it to your components.

3\. Use state like normal.

Seriously: that’s it. Once you’ve connected your components, Restatable takes
care of rest. I’ve been using Restatable in two of my personal projects so
far, and I’m incredibly happy with the way it’s turned out. Although I’m
content using the library myself, I wanted to show it because I wanted some
community feedback.

Although I’ve yet to run into any hiccups with Restatable, I’m not an expert
on the inner workings of React - that’s why Restatable calls setState
internally and lets React manage the rest. I haven’t really battle tested
Restatable and am unsure if I’m doing something dangerous here.

What do you think? Let me know!

