redux-thunk的配置

npm install --save redux-thunk
// 创建store
import {createStore, applyMiddleware, compose} from “redux”;
import red from ‘./reducer’;
import thunk from ‘redux-thunk’

// redux-thunk
const composeEnhancer = window.REDUX_DEVTOOLS_EXTENSION_COMPOSE ?
window.REDUX_DEVTOOLS_EXTENSION_COMPOSE({}) : compose()
const enhancer = composeEnhancer(applyMiddleware(thunk))

const store = createStore(
red, enhancer
)
export default store

猜你喜欢

转载自blog.csdn.net/qq_47291265/article/details/121447525