Learn About Redux

Learn About Redux

Today we are going to learn about redux. Oh, not regular redux but react-redux. Yes today, we are going to learn about the react-redux. Actually, it's not an article where you can master react-redux, rather you will have a clear basic understanding of redux, and react-redux, like what is redux and what is react-redux, and what is the difference between them.

What is redux

Redux is an open-source JavaScript library for managing the application state. It is most commonly used with libraries such as React or Angular for building user interfaces. Similar to Facebook's Flux architecture. Learn More

What is react-redux

React-redux is an open-source react library for react applications state management. Yes, react has by default options to send data from one component to another component by using props or context API.

Props and context API are really cool and easy to use for small-scale websites. But when you are working with enterprise-level applications, that time you will find that props and context API are quite frustrating for state management. This is where react-redux comes to help you. So we can say, react-redux is really helpful for enterprise-level applications.

When to use redux

You have to keep in mind that, you don't need to use redux for all the applications. It's important to understand the kind of application you're building, the kinds of problems that you need to solve. Then you have to solve that problem. If you try to solve all the problems with one solution that you have learned a year ago you are not a smart developer.

Redux helps you deal with shared state management, but like any tool, it has tradeoffs. It's not designed to be the shortest or fastest way to write code. It's intended to help answer the question "When did a certain slice of state change, and where did the data come from?", with predictable behavior. There are more concepts to learn, and more code to write. It also adds some indirection to your code and asks you to follow certain restrictions. It's a trade-off between short-term and long-term productivity.

Redux is most useful in the case below

  • You have large amounts of application state that are needed in many places in the app

  • The app state is updated frequently

  • The logic to update that state may be complex

  • The app has a medium or large-sized codebase and might be worked on by many people

  • You need to see how that state is being updated over time

How to learn redux

Well, it depends totally on you, how do you like to learn. But if I talk about my experience when I started learning redux, Actually, I found redux quite complicated. I was searching on youtube and google for a simple explanation. But that was just in vain.

Then I thought, maybe no one created any simple explanation for this topic. But later on, I understood that there's a lot of simple explanation out there. But the problem is the topic is not that simple. So, of course, I have to spend some time understand it. Because it's advance level topic. So guys, if you are in a situation just like me, don't give up. stay calm and keep practicing. It will be clear to you very soon.