Binding forms at multiple different mount points with redux-form
As I understand from the react-form documentation, you normally put a form
reducer at the root of your reducer tree, and redux-form will put each form's state inside this form
key, based on the form's name.
However this will result in a strange structure, whereby the form data for a certain tree is under the form key, and not with the other state data related to it. In this example, the app stores a list of possible account types from the server, which logically should be grouped with the signup form itself. However with redux-form they'll be in completely different subtrees:
signup
/
forms
/ \
/ login
/
root
\ login--signinMethods
\ /
header
\
signup--accountTypes
I'd much rather a more organised tree like this:
form
/
signup
/ \
/ accountTypes
/
root
\ signinMethods
\ /
login
\
form
Is this possible with redux-form, or any other redux library?
Answer
Try using the reduxMountPoint option:
The use of this property is highly discouraged, but if you absolutely need to mount your redux-form reducer at somewhere other than form in your Redux state, you will need to specify the key you mounted it under with this property. Defaults to 'form'.
Related Questions
- → Import statement and Babel
- → should I choose reactjs+f7 or f7+vue.js?
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → .tsx webpack compile fails: Unexpected token <
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → React Native with visual studio 2015 IDE
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
- → How do I determine if a new ReactJS session and/or Browser session has started?
- → Alt @decorators in React-Native
- → How to dynamically add class to parent div of focused input field?