有没有办法在渲染时自动注入深度嵌套的实体数据?
const mapStateToProps = (state, ownProps) => {
let boardId = ownProps.params.id
return {
id: boardId,
// is there an easier method to do this?
comments: state.entities.boards[boardId].comments.map(id => {
return Object.assign({}, state.entities.comments[id], {
user: state.entities.users[state.entities.comments[id].user]
})
})
}
}