Skip to content

hosseinmd/react-hook-form-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-hook-form-context

This is a wrapper on react-hook-form with some additional Benefits.

  • Use multiple form in your component without need to managing context of them.
  • Be type safe when use all of react-hook-form utils.

Create Context

const FormContext = createFormContext({
  param: "",
});

function App() {
  return (
    <FormContext.Provider mode="submit" revalidateMode="onChange">
      ...rest
    </FormContext.Provider>
  );
}

//In your Component
const { param } = FormContext.useWatch();

<FormContext.Controller
  name="param"
  render={({field})=><input {...field}>}
/>

About

A wrapper on react-hook-form with all of it features.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published