DEV Community

Cover image for Recoil - Facebook's own State Management Library

Recoil - Facebook's own State Management Library

Shubham Kamath on May 16, 2020

I have used Redux as my state management library extensively in projects. It takes time to set it up but once everything is up, there is no looking...
Collapse
 
danwood profile image
Dan Wood •

Can you elaborate on "Uses React Hooks unlike Redux" please?

react-redux.js.org/api/hooks

Collapse
 
barzi92367868 profile image
Barzi •

Yes, that was my same reaction. I find that react-redux has great hooks, and I find them incredibly easy and fun to use...
Besides that, I liked the article. I didn't grasp 100% of the concepts, but it made me interested in recoil.

Collapse
 
shubhamk profile image
Shubham Kamath •

First of all thanks a lot. Hope you make something amazing out of it.

Secondly, I apologise for "react-redux" . I should have researched if don't know about it. I'll make sure to correct it. 😌

Collapse
 
shubhamk profile image
Shubham Kamath •

Thanks for pointing it out. I'm still new to hooks as I have be using class since ages. I'll correct it.

Collapse
 
stevetaylor profile image
Steve Taylor •

It uses promises, which makes it a non-starter for me. Promises can’t be cancelled, so there’s no way to abort pending API requests when they’re no longer needed.

Collapse
 
shubhamk profile image
Shubham Kamath •

Yes. Totally!

But if the application is tiny, this can be handy!

Collapse
 
stevetaylor profile image
Steve Taylor •

Recoil looks like it’s made for non-trivial apps. It’s very promising (pun not intended) in many ways. It just needs to be a better fit with respect to async.

It’s a pity Observable isn’t yet standardized.

Thread Thread
 
shubhamk profile image
Shubham Kamath •

It's recently launched, so there is plenty of room for improvement. What library you suggest based on Observables?

Thread Thread
 
stevetaylor profile image
Steve Taylor •

There’s Redux Observable by Netflix.

I prefer Bacon.js over RxJS because it’s more expressive, less verbose, and uses hot observables instead of cold. I created react-baconjs to use it with React.

You could also use Bacon.js with Redux Observable as there’s some interop with standard(ish) observables.

I’d be interested to see how observables could be used with Recoil.

Thread Thread
 
shubhamk profile image
Shubham Kamath •

I will surely try this. Thanks a lot sir!

Collapse
 
zarabotaet profile image
Dima • • Edited

I am using effector, who solved these problems and many others more than a year ago.

Side effects in selectors its 🤯

Collapse
 
shubhamk profile image
Shubham Kamath •

I am unaware of effector, I'll try it too.

JS is huge huge huge. 👀

Collapse
 
zarabotaet profile image
Dima •

Effector - fast and powerful state manager

• statically typed
• multi-store
• less boilerplate by design
• computed values
• no need for memoization
• side-effect management
• framework agnostic
• observable interoperability
• relatively small size

codeburst.io/effector-state-manage...

Thread Thread
 
shubhamk profile image
Shubham Kamath •

Thanks 😌

Collapse
 
gypsydave5 profile image
David Wickes •

Reminds me of Clojure and ClojureScript libraries from about three years ago.

Collapse
 
shubhamk profile image
Shubham Kamath •

Wow. Thanks for letting me know something that I would have never known otherwise in this vast pool of JS. 😌

Collapse
 
nickytonline profile image
Nick Taylor •

Congrats on your first post!

1st place in Mariokart

Collapse
 
shubhamk profile image
Shubham Kamath •

Thanks a lot Sir! 😬

Collapse
 
alexandrzavalii profile image
Alex Zavalii •

thats how you could implement persistence:
github.com/facebookexperimental/Re...

Collapse
 
shubhamk profile image
Shubham Kamath •

Thanks for letting me know. Recoil docs are changing rapidly though! 😅