-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
feature requestrequest a feature to be addedrequest a feature to be addedwaiting-up-voteWaiting for votes from the community.Waiting for votes from the community.
Description
Is your feature request related to a problem? Please describe.
.setValue does not exists on controller or lens, it is difficult to work wirh nested from components
Describe the solution you'd like
I'd like lens.setValue() or useController().setValue()
Describe alternatives you've considered
For now my cumbersome and untyped workaround is:
function MyNestedFormComponent({formLens}:{formLens: Lens<{name: string}>}){
const nameController = useController(formLens.focus("name").interop());
const nameOnChange = nameController.field.onChange;
useEffect(() => {
nameOnChange({target: {value: "John Doe"}})
}, [nameOnChange])
}
I am not prop drilling const setMyField = (value) => form.setValue("myField", value)
since it would defeat the purpose to have reausable form components operating with lenses
mpetran
Metadata
Metadata
Assignees
Labels
feature requestrequest a feature to be addedrequest a feature to be addedwaiting-up-voteWaiting for votes from the community.Waiting for votes from the community.