DEV Community

Discussion on: Redux or Recoil?

Collapse
 
jimmymcbride profile image
Jimmy McBride

You should what you feel is right. Personally, I would go and read the documentation on Recoil and see how I feel about it. If the documentation is great and I feel like I understand what they're telling me and I'm jiving with it, I would totally go Recoil. But, if I didn't jive or get it, I would stick to redux.

I think the Redux hooks make your code way cleaner than using the connect HOC. Here's an article I wrote comparing Redux hooks to connect HOC and the syntax of it all.

Collapse
 
jessesbyers profile image
Jesse Smith Byers

I will definitely check out your article. Thank you for sharing all of your ideas. I especially like "You should do what you feel is right". Sometimes I feel like there is a lot of judgment over the right or best way, when many different options are valid. Thanks for the reminder!

Collapse
 
jimmymcbride profile image
Jimmy McBride

Any time! Everybody has ideas and opinions and while those are super useful to hear and consider when making decisions, at the end of the day, you'll sleep better if you go with your gut. :)

Collapse
 
jimmymcbride profile image
Jimmy McBride • Edited

Also, going React context API is another way to go as well. Nothing wrong with that. For larger projects that use global state management, the Redux middleware logger is a beautiful thing in my opinion. If you use the Redux toolkit, it comes built-in with a logger type middleware and has some even fancier things that you can do with it. I prefer Redux over context for all the dev tools and fancy features that you can add to it. I also like the syntax of it all.

These days, I build my back ends with GraphQL and Apollo, so I let Apollo manage all of my state coming from the API. Apollo cache has some amazing features that Redux doesn't have. Like when you update a table and you can update the cache everywhere in your UI by just specifying that you want to refetch a query when the mutation is done. Lot's of great dev tools as well. Apollo does an amazing job at state management in my opinion.

Collapse
 
jessesbyers profile image
Jesse Smith Byers

I took the Redux hooks route in the end. So nice to use!

Collapse
 
jimmymcbride profile image
Jimmy McBride

Nice! That's good to hear. Glad it worked out for you. :)