FormContext provides a way to share a form state to another components in the tree.

const form = useForm(...)
<ContextForm.Provider value={form}>
{/* ....another components */}


useFormContext is a custom hook, this hook provides the same useForm hook API. If using typescript should pass type of the values.

This hook only will work if there is a parent with FormContext.

More details about React context

const {register, ...form} = useFormContext(...)
<Input placeholder="Name" {register('')}/>