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
render a hidden input containing the field's current value
create an onChange function that I can pass to a custom component for editing multiple fields at once (e.g. a modal window for editing this value), that calls the change event for each field
However this won't work as the rules of hooks will prevent us from calling useInputControl an unknown number of times, inside a map.
It would be nice to be able to use the field directly:
useInputControl(field)
but this hook, by design, cannot be applied to a field that has an object as a value.
For fields that are of type Record<string, string>, it would be nice to have access to a useInputControls or useControls hook (plural) in order to create and render multiple controls, as described above.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Say I have a component:
And for each property in the field, I want to:
At the moment I could potentially do this by:
render some hidden inputs
and pass the onChange to my custom component
However this won't work as the rules of hooks will prevent us from calling
useInputControl
an unknown number of times, inside a map.It would be nice to be able to use the field directly:
but this hook, by design, cannot be applied to a field that has an object as a value.
For fields that are of type
Record<string, string>
, it would be nice to have access to a useInputControls or useControls hook (plural) in order to create and render multiple controls, as described above.Beta Was this translation helpful? Give feedback.
All reactions