Creating a Store

In notebook:
FrontEndMasters Intermediate React
Created at:
2019-06-25
Updated:
2019-08-15
Tags:
React libraries JavaScript

https://frontendmasters.com/courses/intermediate-react-v2/creating-a-store/

Create a redux store

  //    ****        store.js        ****

import { createStore } from "redux";
import reducer from "./reducers";

const store = createStore(
  reducer,
  // this is just for using 
  // React devtools
  // if React devtools exist, use them
  // otherwise just give a "bogus" function (`f => f`)
  typeof window === "object" &&
    typeof window.__REDUX_DEVTOOLS_EXTENSION__ !== "undefined"
    ? window.__REDUX_DEVTOOLS_EXTENSION__()
    : f => f
);

export default store;