Answers for "redxu store with middleware and devtools"

2

redux devtools with middleware

import { applyMiddleware, compose, createStore } from "redux";
import thunk from "redux-thunk";
import rootReducer from "./rootReducer";

// for this we'll use Redux "compose" function
const enhancers = compose(
  applyMiddleware(thunk), // your own middleware
  window.devToolsExtension ? window.__REDUX_DEVTOOLS_EXTENSION__() : (f) => f
);// devtools middleware

export const store = createStore(rootReducer, enhancers);
Posted by: Guest on January-31-2021

Code answers related to "redxu store with middleware and devtools"

Code answers related to "Javascript"

Browse Popular Code Answers by Language