兩種說法我已經檢查與初始值reduxForm的示例代碼之間的區別,他們的代碼和我的代碼之間的唯一區別是下面的代碼塊..陣營 - 與reduxForm
我的代碼(隱而不宣「t置換initialValues工作)
function mapStateToProps(state) {
return{
initialValues: state.account.data
};
}
export default reduxForm({
form:'initializeFromState'
})(connect(mapStateToProps,{load: loadAccount})(InitializeFromStateForm));
他們的代碼(與InitialValues工程)Taken from here
InitializeFromStateForm = reduxForm({
form: 'initializeFromState', // a unique identifier for this form
})(InitializeFromStateForm);
// You have to connect() to any reducers that you wish to connect to yourself
InitializeFromStateForm = connect(
state => ({
initialValues: state.account.data, // pull initial values from account reducer
}),
{ load: loadAccount }, // bind account loading action creator
)(InitializeFromStateForm);
export default InitializeFromStateForm;
我改變了自己的代碼connect()和reduxForm與我,有趣的是,initialValues停止工作,現在我的問題是都是不同的代碼?如果不同我的代碼有什麼問題?
謝謝。
完美!它的工作..非常感謝。 – iphonic