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)