Constall useForm methods
function App() {
  const methods = useForm();
  const onSubmit = data => console.log(data);
  return (
    <FormProvider {...methods} >
      <form onSubmit={methods.handleSubmit(onSubmit)}>
        <NestedInput />
        <input type="submit" />
      </form>
    </FormProvider>
  );
}
 function NestedInput() {
  const { register } = useFormContext(); // retrieve all hook methods
  return <input {...register("test")} />;
}
A provider component that propagates the
useFormmethods to all children components via React Context API. To be used with useFormContext.