Contents of React Interview Questions

Comprehensive collection of React interview questions and answers covering hooks, components, state management, and best practices.

What are the main building blocks of Redux (Actions, Reducers, Store)?

Redux is built on three main building blocks:

  1. Actions
    Actions are plain JavaScript objects that describe what happened.
    Example:

    { type: 'INCREMENT' }
  2. Reducers
    Reducers are pure functions that take the current state and an action as arguments and return a new state.
    Example:

    function counterReducer(state = 0, action) { switch (action.type) { case 'INCREMENT': return state + 1; case 'DECREMENT': return state - 1; default: return state; } }
  3. Store
    The store holds the application state. It brings Actions and Reducers together.
    It provides methods like dispatch(action), getState(), and subscribe(listener).

These three pieces work together in a unidirectional flow to manage state consistently across your app.