Search posts, tags, users, and pages
Would you mind giving tips when to opt for Redux?
Hey Dinys, As you know, Redux is a state management library. When you are working on a big project, with many components and UI flows, state management using the conventional React patterns can be painful. That is why redux was created borrowing patterns from the flux architecture. So, the answer to your question is that when you are working on such a project, you should opt for a library like Redux (there are others too like MobX). Having said all this, nowadays, with React's context API (introduced in React 16), most of the heavy lifting of managing state is handled by React itself if you are using context at right places. Honest speaking, learning Redux is more about learning the pub-sub model it is based on. In many interviews, they ask you to create a state store like how Redux has. Now, if you have not delved into and used a state management library like Redux, the implementation will look alien to you. The underlying architecture of redux is amazing.
So, I'd say even if you are not using it and working your way out using Context API , learn redux to understand the beauty of the underlying architecture.
Also, if you want a starting point for Redux, go for Dan Abramov's redux tutorial on egghead.io
Thank you for your answer, I don't having anything against React Context API, but I feel that with time there is a lot of duplication.
However, with my small project, I only use React Context API thought. I would not say that it replaces Redux. Redux provides greater visibility of your state throughout each component.