https://github.com/itschip/keep-react-hook-form
A lib to store react-hook-form values in session storage.
https://github.com/itschip/keep-react-hook-form
Last synced: over 1 year ago
JSON representation
A lib to store react-hook-form values in session storage.
- Host: GitHub
- URL: https://github.com/itschip/keep-react-hook-form
- Owner: itschip
- Created: 2022-01-27T19:27:54.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-27T19:53:01.000Z (over 4 years ago)
- Last Synced: 2025-03-20T03:15:01.739Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A lib to store `react-hook-form` values in session storage.
```tsx
type FormData = {
username: string;
email: string;
}
function App() {
const { register, watch, setValue } = useForm({ defaultValues: { email: '', username: '' } });
usePersistForm({
formName: "login",
watch,
setValue,
shouldValidate: true,
shouldDirty: true,
onRestored: (values) => {
console.log(values)
}
})
return (
);
}
```