react-redux 使用后台数据初始化(渲染)界面
注:首先在redux中改变state只能通过action操作,reducers改变state
在组件中
store.js
import { createStore } from "redux"; import rootReducer from './reducers/index'; let store = createStore(rootReducer); export default store;
reducers.js中更新state为后台获取的数据
actions.js中声明操作行为
详细代码百度云:https://pan.baidu.com/s/1E8ZYh8vxXWDjMGIz0s6Uvw
提取码:ug5e