When to and when not to use Redux in front-end frameworks

rajkumarmp

Rajkumar.MP

Posted on February 29, 2020

When to and when not to use Redux in front-end frameworks

Before we discuss, I just need to give some points about what that Redux is.

  • Its Flux architecture.

  • Single source of truth - Application stored data in a single store.

  • Pure Function - Through functional params only we can change the store value.

  • Immutable - Its read-only. Through pure function reducers only we can change the store value.

When we do some courses in JS frameworks like React, Angular, etc... the redux will be one of the important topics for data management, so developers will think the redux will be a major part of any project.

when we start our new project, we will always start to use redux, here the problems getting occurred, if your project is small and data management is straight forward then the redux is frustration work. With that frustration, I got to see some blog comments as redux usage is a waste of time and useless work.

Before we are going to use the Redux in any application, try to ask yourself a few questions, which I do normally.

  • Is data change need to update and show the updated data in different components in my application ?.

  • Is user interaction will need to do data change with some business logic that needs to implement internally to make display that information in your utilizing components ?.

If your answer is YES for both questions, then my preference is to go to redux.

Let's have example projects to check whether redux will need or not.

  • TimeZone based Clock: It needs only very few components, so we can do the direct store value passing without Redux.

  • Ecommerce Wishlist/Cart: For storing the data and retrieve and use those data, we need to handle the selected product information in many components and different pages like (Recommendation Products, Product List Page, Product Selection Page), so to manage those details, Redux will help to maintain the state properly and do their corresponding logics in their reducers and give the corresponding necessary data to the page.

In Simple Words, "if some information to pass through one or two class students we will tell directly to the class, if you need to pass that information to the school, you will use the mic to inform it",

Redux is like a mic, use wisely and understand when it need then you will know why people always talking about the benefits of Redux.

NOTE: As I am new to the blogging, so any comments about the blog or improvement, you can provide me those will help to do better work in the future.

💖 💪 🙅 🚩
rajkumarmp
Rajkumar.MP

Posted on February 29, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related