Closed rvetere closed 1 year ago
Do you mean in a custom form component? IE you're wanting to do:
function FormContainer() {
const formState = useFormState();
// ...
}
const MyForm = createTsForm(mapping, {FormComponent: FormContainer});
Or do you mean accessing the form state in the parent component of the form?
Right now this should be possible via passing props to the form component. Something like:
function FormContainer({isLoading}:{isLoading: boolean}) {}
//...
const MyForm = createTsForm(mapping, {FormComponent:FormContainer});
function Page() {
return (
<MyForm
formProps={{isLoading: isLoading}}
/>
)
}
Gonna close this, but feel free to reopen if the above isn't able to do something you're looking for
Is there any way to access the
formState
in a custom form implementation? We want to display some kind of loading spinner when the form is submitting.When i'm in a field, i can easily use
useTsController
but this is only allowed within fields, not in forms.