redux中开启异步action

安装redux-thunk
import install redux-thunk

在store.js中引入

// 引入createStore,撞门用于创建redux中最为核心的store对象
import  {createStore,applyMiddleware}  from 'redux'

//处理异步的action
import thunk from 'redux-thunk'

// 引入为count组件服务的reducer
import countReducer from './count_reducers'

// 暴露出去
export default createStore(countReducer,applyMiddleware(thunk))

redux中开启异步action_第1张图片
redux中开启异步action_第2张图片

你可能感兴趣的:(react,react,前端开发)