You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see, I have some state, a form initialised with useForm and a component that uses the setter to pass UP the additional fields to be set, which is then used in the form context. I was wondering if there's a neater way to set some context? Since I'm constantly doing this bidirectional dance with the flow of data — I'd rather have some way to use the form in MySubForm to then set the context there instead of having the state lifted up to the parent form.
Potential solution
Something like where in the MySubForm component I could do
const MySubForm = ({ form }) => {
function additionalFieldsChange (additionalFields) {
form.updateContext({ additionalFields: additionalFields.map(a => a.name) })
}
}
Use cases
I feel this would be super useful for subforms to be able to interact/update the form themselves rather than having a lot of setters that propagate to the parent form component, as is such in my codebase.
The text was updated successfully, but these errors were encountered:
Problem
I have a situation where I have the following code
As you can see, I have some state, a form initialised with useForm and a component that uses the setter to pass UP the additional fields to be set, which is then used in the form context. I was wondering if there's a neater way to set some context? Since I'm constantly doing this bidirectional dance with the flow of data — I'd rather have some way to use the form in MySubForm to then set the context there instead of having the state lifted up to the parent form.
Potential solution
Something like where in the MySubForm component I could do
Use cases
I feel this would be super useful for subforms to be able to interact/update the
form
themselves rather than having a lot of setters that propagate to the parent form component, as is such in my codebase.The text was updated successfully, but these errors were encountered: