Skip to content
Related Articles

Related Articles

What is Redux Toolkit and why it is more preferred?

View Discussion
Improve Article
Save Article
  • Last Updated : 27 Oct, 2020

While working as a Front-end Developer or Full Stack Developer, many engineers encountered Redux. But Recently Redux Team launched Redux Toolkit, an officially recommended and a SOPE library that stands for Simple, Opinionated, Powerful, and Effective state management library. It allows us to write more efficient code, speed up the development process, and automatically apply the best-recommended practices. It was mainly created to solve the THREE MAJOR ISSUES with Redux:

  • Configuring a Redux store is too complicated
  • Have to add a lot of packages to build a large scale application
  • Redux requires too much boilerplate code which makes it cumbersome to write efficient and clean code.

It also provides the automatic support for Redux Dev-tools Extension and for immer.js library which is a great tool to deal with immutable objects. You can also use the various predefined functions of Redux Toolkit which not only speeds up the process but also saves time.

Dependencies that comes along with Redux Toolkit:

  • immer
  • redux
  • redux-thunk
  • reselect


npm install @reduxjs/toolkit

# Yarn
yarn add @reduxjs/toolkit

What Extra Features Are Provided:

  • A configureStore() function which provides automatic support for Redux-thunk, Redux DevTools Extension, and also passes the default middleware.
  • A createReducer() utility which provides support for immer library that allows writing the immutable code mutably.
  • A createAction() utility that returns an action creator function.
  • A createSlice() function that comes in handy to replace create action and create Reducer functions with a single function.
  • A createAsyncThunk() that takes Redux strings as arguments and returns a Promise.
  • A createEntityAdapter() utility that helps to perform CRUD operations.

A Basic Comparison Between Redux and Redux Toolkit(with React):

  1. Redux: Creating Store and reducers.


    const addHandler=(state=0,action)=>{
        return state+1;
    return state;
    const store = createStore(addHandler);

  2. Redux Toolkit: Creating Store and reducers.


    // Action Creators
    const add = createAction('ADD'); 
    const addHandler = createReducer(0, {  
      [add]: state => state + 1
    const store = configureStore({
      reducer: addHandler

Using Redux DevTools Extension:

  1. React: You have to add a predefined statement while creating the store to access the Redux DevTools.


    const store = createStore(
      reducer,   window.__REDUX_DEVTOOLS_EXTENSION__ && 

  2. Redux Toolkit: It provides automatic support for Redux DevTools Extension.


    const store = configureStore(
      reducer:rootReducer );

Modifying The State:

  1. Redux: We need to manually handle and change the state immutably.


    const initialState={
    const handler=(state=initialState,action){

  2. Redux Toolkit: It provides the support for immer.js library which automatically changes the code immutably.


    const initialState={
    const handler=(state=initialState,action){


  1. Redux Toolkit is beneficial to all Redux users regardless of skill level. It can be added as an internal part of the project at the start or can be added during the internal up-gradation in the existing one. 
  2. But it is still preferred that you should have the basic knowledge of how to handle and change the state immutably and also should have a glimpse of what is happening under the hood before migrating from Redux to Redux Toolkit.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!