liddat also can series of multi-<Provide />-ing Redux store

Wei / is fe / Mar 19 2020

how many
- store(s)
- <Provider />'s

are there in your app?

you're building a React Redux app,

import * as React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { combineReducers, createStore } from "redux";
import Books, { bookReducer } from "./Books";

const store = createStore(bookReducer);

const rootElement = document.getElementById("root");

  <Provider store={store}>
    <Books />

now time to get creative, is there a situation where you would want multiple stores?


serving the state


  • React.useState()

  • React.useReducer()

  • Redux

increasing complexity

complexity in the component itself

  • deeply nested objects
  • complex arrays

complexity in state transition & interaction

  • multiple interactions modifying the same state
  • multiple child components modifying the same state
  • state changes that may happen during the same component render pass


  • single variables independent of each other

  • suitable for easy states

Normally when we use React Redux, we wrap the whole app with a <Provider />

state management with kaya toast

By Wei Gao

state management with kaya toast

  • 263