Member-only story

Redux for beginners

Pratik Rai
3 min readDec 19, 2024

--

Redux for beginners
Photo by Lautaro Andreani on Unsplash

Read for free : https://medium.com/@pratikkumar399/redux-for-beginners-4883eea242f9?sk=1ee7008d3a7c102f0427999230842355

Redux is a state management library for JavaScript apps, commonly used with React but also compatible with other libraries.

Core Concepts

  • Store: Holds the entire application state. It is a single source of truth, making state management predictable and centralized.
  • Actions: Plain JavaScript objects that describe events or changes in the app. Actions must have a type property (a string constant), and they may also carry additional data (payload).
  • Reducers: Pure functions that take the current state and an action as inputs, and return a new state. They describe how the state should change in response to an action.
  • Dispatch: A function used to send actions to the store. When an action is dispatched, the store forwards it to the reducers to update the state.
  • Selectors: Functions used to extract specific pieces of data from the store.

Redux Flow

  1. A component dispatches an action.
  2. The action is sent to the reducer.
  3. The reducer calculates the new state based on the action.
  4. The store is updated with the new…

--

--

No responses yet