{"id":16557856,"url":"https://github.com/lewhunt/react-use-form-data","last_synced_at":"2026-05-20T14:05:05.610Z","repository":{"id":57347115,"uuid":"232369585","full_name":"lewhunt/react-use-form-data","owner":"lewhunt","description":"a custom React Hook that lets you easily populate and update form input data within functional components","archived":false,"fork":false,"pushed_at":"2020-04-08T13:20:02.000Z","size":16976,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T21:03:01.503Z","etag":null,"topics":["demo","editor","form","form-data","hook","input","react","react-hook","react-hooks","tool"],"latest_commit_sha":null,"homepage":"https://lewhunt.github.io/react-use-form-data/","language":"JavaScript","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/lewhunt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-07T16:41:39.000Z","updated_at":"2024-07-12T17:11:11.000Z","dependencies_parsed_at":"2022-09-16T05:01:50.188Z","dependency_job_id":null,"html_url":"https://github.com/lewhunt/react-use-form-data","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lewhunt/react-use-form-data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewhunt%2Freact-use-form-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewhunt%2Freact-use-form-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewhunt%2Freact-use-form-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewhunt%2Freact-use-form-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lewhunt","download_url":"https://codeload.github.com/lewhunt/react-use-form-data/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lewhunt%2Freact-use-form-data/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265550337,"owners_count":23786543,"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","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":["demo","editor","form","form-data","hook","input","react","react-hook","react-hooks","tool"],"created_at":"2024-10-11T20:08:42.797Z","updated_at":"2026-05-20T14:05:05.559Z","avatar_url":"https://github.com/lewhunt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React-Use-Form-Data Custom Hook\nThis custom React Hook lets you easily populate and update form input data within functional components.\n\n**Example of use with an editor**\n![Example](https://github.com/lewhunt/assets/raw/master/readme/react-use-form-data-example.gif)\n\n[Basic Demo](https://lewhunt.github.io/react-use-form-data/)\n\nIt can be useful for prototyping with form editors that need to control sub-component props. The demo used in [React Video Looper](https://github.com/lewhunt/react-video-looper) uses this hook to manage the form data state, passing props down to the video component.\n\nCurrently it's configured to handle the following input field types: number, text, button and checkbox.\n\n## Install\n### npm package (recommended)\n```bash\nnpm i react-use-form-data\n```\n\n### CDN script (for prototyping only)\n```js\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/react-use-form-data/umd/react-use-form-data.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n### Node.js development setup (recommended)\n1. Import the installed Hook\n2. Call the Hook with initial form data as key name-value pairs\n3. Configure your form fields to read in formData and update via events to updateFormData()\n\n### Sample code snippet\n```js\n//1. IMPORT THE HOOK \nimport React from 'react'\nimport useFormData from 'react-use-form-data'\n\nexport default function Demo() {\n\n    // 2. CALL THE HOOK WITH INITIAL DATA AS NAME-VALUE PAIRS\n    const [formData, updateFormData] = useFormData({ \n        numberField: 101,\n        textField: 'hello world',\n        checkboxField: true\n    });\n \n    // 3. FORM FIELDS THEN READ IN STATE DATA FROM formData AND UPDATE DATA VIA updateFormData\n    return (\n        \u003cdiv\u003e\n            \u003cinput type='number' \n                value={formData.numberField} \n                onChange={(evt) =\u003e updateFormData('numberField', evt)}\n                data-testid='numberField' /\u003e\n\n            \u003cinput type='text' \n                value={formData.textField} \n                onChange={(evt) =\u003e updateFormData('textField', evt)}\n                data-testid='textField' /\u003e\n\n            \u003cinput type='checkbox' \n                checked={formData.checkboxField} \n                onChange={(evt) =\u003e updateFormData('checkboxField', evt)}\n                data-testid='checkboxField'/\u003e\n        \u003c/div\u003e\n    )\n}\n```\n\n### Usage via browser script (for prototyping only)\nSee sample file in [demo/umd-example.html](https://github.com/lewhunt/react-use-form-data/blob/master/demo/umd-example.html)\n\n## License\nMIT © [Lewis Hunt](https://github.com/lewhunt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flewhunt%2Freact-use-form-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flewhunt%2Freact-use-form-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flewhunt%2Freact-use-form-data/lists"}