所以我从智能组件传递给哑组件的键列表越来越大了?
有没有其他方式以简洁和快捷的方式写这个?
const mapStateToProps = (state) => {
let {keya, keyb, keyc, keyd, keye} = state.SomethingReducer.Table;
return {
keya: keya,
keyb: keyb,
keyc: keyc,
......
}
}
答案 0 :(得分:2)
您可以使用ES6功能增强对象文字。
const mapStateToProps = (state) => {
let {keya, keyb, keyc, keyd, keye} = state.SomethingReducer.Table;
return {
keya,
keyb,
keyc,
......
}
}