redux-form version: 5.3.1
I mount the redux-form reducer at the child node and it take a error:
Uncaught Error: You need to mount the redux-form reducer at "form"
So can I mount the redux-form reducer not at the top-level of the state tree?
Regards.
You've closed this, so perhaps you have the answer, but the answer, for future visitors is:
You can specify a getFormState(state) => redux-form slice
config parameter to accomplish this. So, if you really wanted to (there is rarely a good reason) do what you're doing, you could do:
OperatorManagementForm = reduxForm({
form: 'operatorManagementForm',
getFormState => state => state.operatorManagementReducer.form
})(OperatorManagementForm)
Thank you @erikras for the answer! The docs don't show a sample how to use this. I have many modules in my app which has a huge state. I want to separate forms per module at least. having all forms in one top level branch of the store is going to get nasty fast. So using getFormState
in multiple branches spares me from big trouble later on when the store grows.
BTW, minor typo: getFormState : state => state.operatorManagementReducer.form
(fat arrow instead colon)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
You've closed this, so perhaps you have the answer, but the answer, for future visitors is:
You can specify a
getFormState(state) => redux-form slice
config parameter to accomplish this. So, if you really wanted to (there is rarely a good reason) do what you're doing, you could do: