0
我目前正在构建一个组件以允许用户编辑他们的配置文件设置。窗体有类似字段:使用redux形式,如何组合initialValues的值?
first_name
last_name
了Redux形式目前正在制定initialValues正确像这样:
Profile = connect(
state => ({
initialValues: state.profiles.find(el => el.id === state.currentUser.user_id)
})
)(Profile)
的问题是我还需要包括这种形式UserSettings,所以我想做到这一点:
Profile = connect(
state => ({
initialValues: state.profiles.find(el => el.id === state.currentUser.user_id),
initialValues: {
notification_email_product_feature_updates: state.user_settings.notification_email_product_feature_updates
}
})
)(Profile)
但上面没有工作...我如何添加额外的initialValues它们是在不同的状态对象?
我也试过以下但这不是设定值:
Profile = connect(
state => ({
initialValues: {
first_name: state.profiles.find(el => el.id === state.currentUser.user_id) ? state.profiles.find(el => el.id === state.currentUser.user_id).first_name : '',
}
})
)(Profile)