AKC项目优化

项目优化

客服项目优化

2020-05-12 优化客服 AKIM 项目,部分 redux 数据传递问题。由最顶级组件 Home 一级级以 props 传递数据和 action 的方式改为使用 react-redux 中间件直接注入组件数据的方式:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import Page from './page'
import { bindActionCreators, Dispatch } from 'redux'
import { connect } from 'react-redux'
import * as actions from '@/store/home'
import { IRootState } from '@/store/state'

const mapState = (state: IRootState) => ({
loginReducer: state.loginReducer,
homeReducer: state.homeReducer,
dataReducer: state.dataReducer,
orderReducer: state.orderReducer,
})

const mapDispatch = (dispatch: Dispatch) =>
bindActionCreators(actions, dispatch)

export default connect(mapState, mapDispatch)(Page)
Author: XavierShi
Link: https://blog.xaviershi.com/2020/05/12/AKC项目优化/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.