redux-thunk中间件的使用
2019-07-14 本文已影响0人
coffee1949
// 安装
yarn add redux-thunk
// 配置:当创建store时
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import resucer from './reducer';
const store = createStore(
resucer,
applyMiddleware(thunk)
);