Documentation is not clear #675
Comments
Don't worry about that - start with just const store = createStore(combineForms({
user: initialUserState,
}));
const reducer = combineReducers({
foo: fooReducer,
bar: barReducer,
...createForms({
user: initialUserState,
goat: initialGoatState,
}),
});
Two ways:
Let's say you have a
Yes, you can do that. It's especially useful if you want to do something using the same Redux techniques you would use anywhere else - accessing state from the store.
The reason that works is actually because Hope that helps! I'll link to these answers in the FAQ. |
Wow, thank you for your quick answer!! :)
But then how would I know when and how to use
Ok, but it is still not clear to me what
For me it looks like it also works with other keys, see this example. Isn't that what combineReducers is all about? Thanks a lot for your help! |
@davidkpiano Is it possible to add this example or something similar to the documentation for custom control validation. I feel an example like this using custom Control validation could benefit others. Thanks for a great product! Cheers, G |
Sure thing, @gkweb - I'll add it. |
@davidkpiano. I'd really like to know how I could add the error field validation message as a property to a Control Component? This will allow me to display the error messages inline. I'm using the Material-UI library and the property that I need to pass to the field directly is errorText. Many thanks for your expertise :) |
@bpdons you can do that in <Control model=".email"
...
mapProps={{
errorText: ({ touched, validity }) => {
if (touched && !validity.minLength) {
return 'Must be at least 2 chars';
}
}
}}
/> |
Thanks @davidkpiano for your quick reply. I still can't manage to check the validity with your example. I keep getting 'undefined' as the validity type on line 40 when logging to console. Can you please help with what I'm doing wrong? Many thanks |
Can you open a new ticket with that, @bpdons so it doesn't get lost? |
Is it possible to disable the nested forms from being automatically created? "Forms can be infinitely nested. You can have a form inside a form inside a form! Any sub-model inside a form that isn't a primitive value, such as an object or array, is considered a form. Its form state is accessed with .$form." My data model is a structured JSON object (originally xml on the server) and I'm concerned about performance with additional form meta-data at each level. Thanks! |
@charrison-symfact That's coming in the next version. Want to open an issue so we can track the enhancement? |
Excellent ... issue created as "Disable automatic creation of nested forms for sub-models #1001" |
Good day! Tell me, please, how to organize the application architecture if I have 4 routes and each has its own forms. How to initialize objects of the form when you go to the next page? |
@KokoulinM You can just dispatch |
Thanks for the answer to the previous question. I have another question: like for example the blur event to send data to Google Analytics? It is better to write middleware or make custom reducer?For example: <input type="firstName" |
That's outside the scope of RRF. Use normal React/Redux patterns to accomplish that. |
@davidkpiano any response to #675 (comment)? So far this library looks to be exactly what I need! I am just doing a deep dive to make sure. For example, I don't want to have to specify |
I am not able to install react-redux-form . It is showing npm error. Also, my doubt is react-redux-form and redux-form same or different? Please help me with this as I am a beginner in react and redux. |
I'm new to react-redux-form and I try to find out if it suits my needs. I had a thorough read of the documentation and tried to set up a form. However a lot of things remain unclear to me:
modelReducer
,modeled
andformReducer
)?modeled
is only mentioned on the models page.combineForms
vscreateForms
?forms.$form
(the "top-level" $form object which is not related to a specific form)?$form
objects directly?combineForms()
reducer will live as a model string in the second argument tocombineForms(forms, model)
". (source) I ask because it seems to work just fine usingcombineReducers({ forms: combineForms({ ... }) });
.The text was updated successfully, but these errors were encountered: