DEV Community

Discussion on: Would you use redux or another state management in 2020?

Collapse
 
cescquintero profile image
Francisco Quintero 🇨🇴

Hi @wolfiton

Last year, I worked on a side project. It was a React app that integrated the Google Places API. In one point I needed global state and using Redux was no.

Also, React Context didn't work because I needed a JavaScript object in another page. My use case was very simple and adding Redux was overcomplicating the app.

What did I found? duix. This is a package that helps managing state in the very precise way without all the boilerplate Redux adds 😅

It was easy to use (for me) and in the end helped me with the specific case I was facing. It is no longer maintained but it shows that a simpler state management is possible. 👍🏽

Collapse
 
wolfiton profile image
wolfiton

Thanks for sharing @franciscoquintero, your experience and the detailed reasons why you chose duix.

I really appreciate it.

Collapse
 
cescquintero profile image
Francisco Quintero 🇨🇴

Saw the update to the post. Go ahead with state machines. Try as much as you can to understand them and see how they could benefit the UIs you build.

In the project I worked we have three different apps.

  • The first one had its UI built with React and state management was done with Redux.
  • The second one is a combo of React, MobX, TypeScript, and XState
  • Third one, same as previous.

This guy couldn't be happier, calmer, and doing stuff faster with the MobX, TypeScript, XState stack. He called stuff with Redux "Mental Gymnastics" xD

Thread Thread
 
wolfiton profile image
wolfiton • Edited

Thanks for the quick follow up @franciscoquintero,
I will probably try a simple app with Xstate first to see how the data flows and see what states I will have to take into account, besides "idle".

Update: Did your friend tested his code after using Xstate with Jest, is it even possible?

Thread Thread
 
cescquintero profile image
Francisco Quintero 🇨🇴

Yes. He tested his code. In his opinion, it was easier because state machines are more predictable.

He used React Testing Library and Cypress. I think one of those tools made the testing part easier for him. I will ask him :)