Top Seven Reason for using Redux toolkit

syedhasibrahman

Syed Hasibur Rahman

Posted on March 1, 2022

Top Seven Reason for using Redux toolkit

Reason for using Redux toolkit:

  1. A lot lesser boilerplate code is required compared to Redux.

  2. Redux hooks like useSelector and useDispatch make things so short and easy to use.

  3. We don't need to do manual thunk setup as redux-toolkit comes with out of the box createAsyncThunk which enables we to perform async operations in very hastle free way.

  4. getState is also very helpful in obtaining state variables across any of your actions or async operations.

  5. Mutability might be considered as advantage or disadvantage, but if you're not too used to writing with spread operators, you might love this feature as well. Do straight assignments and let redux toolkit take care of mutability under the hoods.

  6. current can be used to log your state anywhere in case you want to debug and understand where things are going wrong. (Ofcourse, Redux debugger tools are great as well)

  7. Prebuilt templates you might want to use npx create-react-app my-app --template redux-typescript or if you're using it with next: yarn create next-app --example with-redux with-redux-app. It gives you a setup ready redux toolkit boiler plate and also contains a boiler plate of most important redux state management applications so that you could refer them to create your own slices very easily.

I have been using a lot of redux and initially it was a bit confusing but once you get a good command over redux toolkit and if you're using a lot of functional components, you probably would never go back to redux again.

💖 💪 🙅 🚩
syedhasibrahman
Syed Hasibur Rahman

Posted on March 1, 2022

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

Sign up to receive the latest update from our blog.

Related