DEV Community

Md. Al Amin
Md. Al Amin

Posted on • Updated on

Redux Toolkit

What is Redux?

Redux is a predictable state container for JavaScript apps. As the application grows, it becomes difficult to keep it organized and maintain data flow. Redux solves this problem by managing the application’s state with a single global object called Store.

Image description

Redux Workflow

Redux workflow is made of 3 main components. They are:

  1. Store: Central store from where all states are saved and managed. As usual, a reasonable application has only one store.
  2. Actions: Actions are pure JavaScript objects that have specific properties. The property contains an action type and info that need to be updated in the state. Depending on the application a lot of actions happened.
  3. Reducers: Reducers are pure JavaScript functions that perform the action to update the state and return the new state. It takes the current value of a state, takes the action depending on the action type, and returns the new state. Finally, the state is updated in the store where all of the states are managed.

What is Redux Toolkit?

The Redux store setup and the basic configuration to use in an application are similar. It is a waste of time matter to write the same script for different applications. Sometimes it’s a possibility to make mistakes. In a bigger application, there may be other packages needed to configure the Redux. Considering these matters, the needed packages and the basic configuration for the Redux setup are extracted and build a new package, which is Redux Toolkit.
In Redux Toolkit, the basic structure of the Redux and its needed packages are included, which makes our code and folder structure more understandable and organized.

Top comments (0)