目前我正在使用redux-form
,现在我必须将reduxForm
组件连接到我的redux
存储空间。所以,看看文档,我必须做一些像:
// Decorate with reduxForm(). It will read the initialValues prop provided by connect()
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
我在我的组件中做了类似的事情,但eslint
给了我一个错误:
no-class-asign
我是否应该禁用此规则以将其与redux-form
一起使用,或者确实存在管理此类事情的方法?
答案 0 :(得分:5)
你真的不需要重新分配课程。为什么不做像
这样的事情B