I'm not sure how I feel about Redux. On the one hand, it does allow me to share the parts of my app's state with whichever component needs it, but also, to add a new property to the state, I have to add a lot of code: set up the new property in the initial state, add actions, action creators and finally, the reducer. Only then can I add usual wire-up to connect() the component to the state. It seems like a lot hassle. Why do people say it is better for enterprise level apps, when you need to app more code for it to work?
Hey @OmarC! Thanks for your comment. Redux is a great tool when you have a large application that needs to handle complex state logic. In case, you are working on a smaller application, there is a bunch of other alternatives like using the new useReducer hook combine with the React Context.
Hello there! @gdangelo
is completely right! From my experience Redux can do the work! Let's imagine React form with dozens of fields eg. 80, with some crazy business logic where changing one field have impact on state of several other components. Doing this kind of app in 'pure' React would be a problematic. Thanks to Redux, you can retrieve value direct from Store without concern of components hierarchy.
I'm not sure how I feel about Redux. On the one hand, it does allow me to share the parts of my app's state with whichever component needs it, but also, to add a new property to the state, I have to add a lot of code: set up the new property in the initial state, add actions, action creators and finally, the reducer. Only then can I add usual wire-up to connect() the component to the state. It seems like a lot hassle. Why do people say it is better for enterprise level apps, when you need to app more code for it to work?
Hey @OmarC! Thanks for your comment. Redux is a great tool when you have a large application that needs to handle complex state logic. In case, you are working on a smaller application, there is a bunch of other alternatives like using the new useReducer hook combine with the React Context.
Hello there! @gdangelo is completely right! From my experience Redux can do the work! Let's imagine React form with dozens of fields eg. 80, with some crazy business logic where changing one field have impact on state of several other components. Doing this kind of app in 'pure' React would be a problematic. Thanks to Redux, you can retrieve value direct from Store without concern of components hierarchy.
Thanks. The application I'm working on is not that big so maybe that is why it feels a bit cumbersome. I do agree that Redux CAN do the work.