DEV Community

Discussion on: React State Management with Recoil

Collapse
 
havespacesuit profile image
Eric Sundquist

I've spent the last few weeks converting a large part of our project to use this. We went from a tangled mess to a fairly straightforward solution rather painlessly. Very impressed so far!

The ability to avoid prop-drilling, massive-layers of contexts, or large state mgmt libraries with loads of boilerplate (looking at you Redux) all in a clean React-like interface is so refreshing!

As noted, one drawback is the inability to force a selector to re-query the server. You can do it with a hack to use a dependency on a atom. When you want to re-query, set the atom to the next number. Not great, but it gives you an imperative way to control a hard-reload.

Collapse
 
kinga profile image
Kinga Hunyadi

Wow, good job! Yes, that’s what I like about it most, it is “React-like” and we can avoid some boilerplate code.
Interesting hack with the atom, I will keep that in mind ☺️.