Redux
Work flow
Redux Basis
React Redux Basis
Work flow of redux
Redux Demo
1 | import {createStore, combineReducers, applyMiddleware} from 'redux' |
React Redux
in _app.js
1 | import App, {Container} from 'next/app' |
we import store.
In index.js
1 | export default connect(function mapStateToProps(state) { |
store创建,connect 用法, redux实现flux数据流向 通过点击button 触发 action,action调用reducer,更新state,传递给provider,进入react