3 ms·
Salut Marmelab The best way we found is a custom useForm hook (simple to code, using useState's): const { submit, getProps, isLoading, error } = useForm({
by 11235813213455 4y ago
Salut Marmelab
The best way we found is a custom useForm hook (simple to code, using useState's):
const { submit, getProps, isLoading, error } = useForm({ onSubmit: cb, initialValue: {} /*optional*/ });
return (
<form submit={submit}>
<input {...getProps('firstName')} />
very flexible, you can use other wrappers than form or input
react-query is another super useful lib, you could use useMutation() for implementing useForm actually