Answers for "apply middleware redux with REDUX_DEVTOOLS_EXTENSION"

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 "Javascript"

Browse Popular Code Answers by Language