Answers for "redux devtools extension and middleware"

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
1

redux devtools extension

const store = createStore(
   reducer, /* preloadedState, */
+  window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
 );
Posted by: Guest on January-17-2021

Code answers related to "redux devtools extension and middleware"

Code answers related to "Javascript"

Browse Popular Code Answers by Language