{"id":30060180,"url":"https://github.com/tiaanduplessis/react-hook-form-persist","last_synced_at":"2025-08-08T01:42:33.654Z","repository":{"id":37774119,"uuid":"223235328","full_name":"tiaanduplessis/react-hook-form-persist","owner":"tiaanduplessis","description":"Persist and populate react-hook-form form using storage of your choice","archived":false,"fork":false,"pushed_at":"2024-05-22T15:30:26.000Z","size":517,"stargazers_count":177,"open_issues_count":18,"forks_count":22,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-08T19:19:09.865Z","etag":null,"topics":["persistent","persistent-storage","react-hook-form","react-hook-forms"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiaanduplessis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-21T18:10:55.000Z","updated_at":"2025-06-02T14:53:53.000Z","dependencies_parsed_at":"2024-06-18T15:17:03.777Z","dependency_job_id":"c28aa4cb-3f59-4310-98a3-115a4fd87835","html_url":"https://github.com/tiaanduplessis/react-hook-form-persist","commit_stats":{"total_commits":45,"total_committers":13,"mean_commits":"3.4615384615384617","dds":0.8,"last_synced_commit":"19113d47eb51b5db8f66b86c41276e779736def4"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tiaanduplessis/react-hook-form-persist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Freact-hook-form-persist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Freact-hook-form-persist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Freact-hook-form-persist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Freact-hook-form-persist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiaanduplessis","download_url":"https://codeload.github.com/tiaanduplessis/react-hook-form-persist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiaanduplessis%2Freact-hook-form-persist/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269352325,"owners_count":24402672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["persistent","persistent-storage","react-hook-form","react-hook-forms"],"created_at":"2025-08-08T01:42:24.418Z","updated_at":"2025-08-08T01:42:33.613Z","avatar_url":"https://github.com/tiaanduplessis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# react-hook-form-persist\n[![package version](https://img.shields.io/npm/v/react-hook-form-persist.svg?style=flat-square)](https://npmjs.org/package/react-hook-form-persist)\n[![package downloads](https://img.shields.io/npm/dm/react-hook-form-persist.svg?style=flat-square)](https://npmjs.org/package/react-hook-form-persist)\n[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n[![package license](https://img.shields.io/npm/l/react-hook-form-persist.svg?style=flat-square)](https://npmjs.org/package/react-hook-form-persist)\n[![make a pull request](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\nPersist and populate [react-hook-form](https://react-hook-form.com/) form using storage of your choice\n\n## 📖 Table of Contents\n\n- [react-hook-form-persist](#react-hook-form-persist)\n  - [📖 Table of Contents](#-table-of-contents)\n  - [⚙️ Install](#️-install)\n  - [📖 Usage](#-usage)\n    - [Additional examples](#additional-examples)\n  - [📚 API](#-api)\n  - [💬 Contributing](#-contributing)\n  - [🪪 License](#-license)\n\n## ⚙️ Install\n\nInstall the package locally within you project folder with your package manager:\n\nWith `npm`:\n```sh\nnpm install react-hook-form-persist\n```\n\nWith `yarn`:\n```sh\nyarn add react-hook-form-persist\n```\n\nWith `pnpm`:\n```sh\npnpm add react-hook-form-persist\n```\n\n## 📖 Usage\n\n```jsx\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { useForm } from \"react-hook-form\";\n\nimport useFormPersist from 'react-hook-form-persist'\n\nfunction App() {\n  const { register, handleSubmit, watch, errors, setValue } = useForm();\n\n  useFormPersist(\"storageKey\", {\n    watch, \n    setValue,\n    storage: window.localStorage, // default window.sessionStorage\n    exclude: ['baz']\n  });\n\n  const onSubmit = data =\u003e {\n    console.log(data);\n  };\n\n  return (\n    \u003cform onSubmit={handleSubmit(onSubmit)}\u003e\n      \u003clabel\u003efoo:\n        \u003cinput name=\"foo\" ref={register} /\u003e\n      \u003c/label\u003e\n\n      \u003clabel\u003ebar (required):\n        \u003cinput name=\"bar\" ref={register({ required: true })} /\u003e\n      \u003c/label\u003e\n      {errors.required \u0026\u0026 \u003cspan\u003eThis field is required\u003c/span\u003e}\n\n      \u003clabel\u003ebaz (excluded):\n        \u003cinput name=\"baz\" ref={register} /\u003e\n      \u003c/label\u003e\n\n      \u003cinput type=\"submit\" /\u003e\n    \u003c/form\u003e\n  );\n}\n\nconst rootElement = document.getElementById(\"root\");\nReactDOM.render(\u003cApp /\u003e, rootElement);\n\n```\n\n### Additional examples\n\nPersist all form fields:\n\n```js\nuseFormPersist('form', {watch, setValue});\n```\n\nPersist all form fields except password:\n\n```js\nuseFormPersist('form', {watch, setValue, exclude: ['password']});\n```\n\nPersist only the email field:\n\n```js\nuseFormPersist('form', {watch, setValue, include: ['email'] });\n```\n\n\n\n\n\n## 📚 API\n\nFor all configuration options, please see the [API docs](https://paka.dev/npm/react-hook-form-persist).\n\n## 💬 Contributing\n\nGot an idea for a new feature? Found a bug? Contributions are welcome! Please [open up an issue](https://github.com/tiaanduplessis/feature-flip/issues) or [make a pull request](https://makeapullrequest.com/).\n\n## 🪪 License\n\n[MIT © Tiaan du Plessis](./LICENSE)\n    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiaanduplessis%2Freact-hook-form-persist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiaanduplessis%2Freact-hook-form-persist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiaanduplessis%2Freact-hook-form-persist/lists"}