DEV Community

Tushar
Tushar

Posted on

REDUX in short, but Deep!!!

Redux is a state management library for JavaScript applications, mostly used with React. It helps manage application state in a predictable way by using a single store, actions, reducers, and middleware. Learning Redux will enable you to handle complex state logic and side effect.

Reducer
Reducers are pure functions that manage state transitions in applications using Redux or the useReducer hook. They take the current state and an action as arguments and return a new state. Reducers help manage complex state logic in a predictable way.

Slice
In Redux Toolkit, a slice is a collection of reducer logic and actions for a specific feature of your application. Slices simplify Redux code by bundling related logic together and generating actions and action creators automatically.

Action
Actions in Redux are plain JavaScript objects that represent an intention to change the state. They contain a type field indicating the type of action and any additional payload data. Actions are dispatched to reducers to update the application state.

To read data:
we use SELECTOR to SUBSCRIBE to the store

when we click ADD button , it dispatches an ACTION which calls REDUCER function which updates SLICE of our REUDX store and when this data is updated then the COMPONENT which is using this data by SUBSCRIBING to store also changes and latest data is shown.

Image description

Top comments (0)