A Redux application has exactly one store, created by passing it a root reducer function, typically itself combining several smaller reducers, each responsible for one slice of the overall state, via combineReducers() or the equivalent tooling in Redux Toolkit. The store exposes getState() to read the current state at any moment, dispatch(action) to trigger a state update by running the given action through the reducer, and subscribe(listener) to register a callback that fires after every state change — react-redux's Provider and hooks handle this subscription machinery automatically for React components, so most application code never calls these store methods directly.
1Understanding Store
A Redux application has exactly one store, created by passing it a root reducer function, typically itself combining several smaller reducers, each responsible for one slice of the overall state, via combineReducers() or the equivalent tooling in Redux Toolkit. The store exposes getState() to read the current state at any moment, dispatch(action) to trigger a state update by running the given action through the reducer, and subscribe(listener) to register a callback that fires after every state change — react-redux's Provider and hooks handle this subscription machinery automatically for React components, so most application code never calls these store methods directly.
A Redux application should have exactly one store — rather than creating multiple separate stores for different concerns, split the single store's state into different slices using combineReducers(), or Redux Toolkit's configureStore, keeping one unified source of truth.
import { createStore, combineReducers } from 'redux';
const rootReducer = combineReducers({ counter: counterReducer, todos: todosReducer });
const store = createStore(rootReducer);
console.log(store.getState());2Practical Example
Here is a real-world application of Store showing how it is used in production React code.
store.dispatch({ type: 'increment' });
console.log(store.getState().counter);3Best Practices
Follow these guidelines when working with Store:
1. Create exactly one Redux store for the application, splitting state into different slices via combineReducers() or Redux Toolkit's configureStore, rather than multiple separate stores
2. Read from and dispatch to the store through react-redux's useSelector and useDispatch hooks inside components, rather than calling store.getState()/store.dispatch() directly
3. Prefer Redux Toolkit's configureStore over the older, more manual createStore, since it sets up sensible defaults like the DevTools extension and common middleware automatically
Tip: A Redux application should have exactly one store — rather than creating multiple separate stores for different concerns, split the single store's state into different slices using combineReducers(), or Redux Toolkit's configureStore, keeping one unified source of truth.
import { createStore, combineReducers } from 'redux';
const rootReducer = combineReducers({ counter: counterReducer, todos: todosReducer });
const store = createStore(rootReducer);
console.log(store.getState());