📜  带有中间件的 redux devtools - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:53.380000             🧑  作者: Mango

代码示例1
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);