react-thunk中间件 和 react-devtool-e

2020-11-04  本文已影响0人  弱冠而不立

store/index.js 代码如下:

import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import reducer from './reducer';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const store = createStore(reducer, composeEnhancers(
  applyMiddleware(thunk)
));

export default store;
上一篇下一篇

猜你喜欢

热点阅读