{"id":25610471,"url":"https://github.com/siddhesh-10/react-form-binder-2","last_synced_at":"2026-02-20T22:40:02.448Z","repository":{"id":278126642,"uuid":"930369854","full_name":"siddhesh-10/react-form-binder-2","owner":"siddhesh-10","description":"A React hook for form state management with Angular-like two-way binding, nested state support, and validation — all with TypeScript support.","archived":false,"fork":false,"pushed_at":"2025-02-18T06:23:18.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"development","last_synced_at":"2025-10-24T14:42:03.521Z","etag":null,"topics":["npm-package","two-way-data-binding"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-form-binder-2","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/siddhesh-10.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-02-10T14:26:15.000Z","updated_at":"2025-02-18T06:23:22.000Z","dependencies_parsed_at":"2025-02-18T06:40:30.282Z","dependency_job_id":null,"html_url":"https://github.com/siddhesh-10/react-form-binder-2","commit_stats":null,"previous_names":["siddhesh-10/react-form-binder-2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/siddhesh-10/react-form-binder-2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-10%2Freact-form-binder-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-10%2Freact-form-binder-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-10%2Freact-form-binder-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-10%2Freact-form-binder-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siddhesh-10","download_url":"https://codeload.github.com/siddhesh-10/react-form-binder-2/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-10%2Freact-form-binder-2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29667093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T19:49:36.704Z","status":"ssl_error","status_checked_at":"2026-02-20T19:44:05.372Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["npm-package","two-way-data-binding"],"created_at":"2025-02-21T22:22:10.821Z","updated_at":"2026-02-20T22:40:02.417Z","avatar_url":"https://github.com/siddhesh-10.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-form-binder\n\nA React hook for form state management with Angular-like two-way binding, nested state support, and validation — all with TypeScript support.\n\n## Features\n\n- **Automatic Input Binding:** Easily bind input elements to form state.\n- **Nested State Support:** Use dot-notation (e.g., `user.name`) to manage nested state.\n- **Field-Level \u0026 Full-Form Validation:** Supply custom validator functions for individual fields and validate the entire form.\n- **TypeScript Support:** Benefit from strong typings and enhanced IDE experience.\n\n## Installation\n\nUsing npm:\n\n```bash\nnpm install react-form-binder\n```\n\nUsing yarn:\n\n```bash\nyarn add react-form-binder\n```\n\n## Usage\n\n### TypeScript Example\n\n```tsx\nimport React from 'react';\nimport { useFormBinder } from 'react-form-binder-2';\n\ninterface FormValues {\n  name: string;\n  email: string;\n  user: {\n    age: number;\n  };\n}\n\nconst initialValues: FormValues = {\n  name: '',\n  email: '',\n  user: { age: 0 },\n};\n\nconst validators = {\n  name: (value: string) =\u003e (value.trim() === '' ? 'Name is required' : undefined),\n  email: (value: string) =\u003e (/\\S+@\\S+\\.\\S+/.test(value) ? undefined : 'Invalid email address'),\n  'user.age': (value: number) =\u003e (value \u003c 18 ? 'Age must be at least 18' : undefined),\n};\n\nconst MyForm: React.FC = () =\u003e {\n  const { values, errors, bind, validate } = useFormBinder\u003cFormValues\u003e(initialValues, validators);\n\n  const handleSubmit = (e: React.FormEvent\u003cHTMLFormElement\u003e) =\u003e {\n    e.preventDefault();\n    if (validate()) {\n      console.log('Form submitted:', values);\n    } else {\n      console.log('Validation errors:', errors);\n    }\n  };\n\n  return (\n    \u003cform onSubmit={handleSubmit}\u003e\n      \u003cdiv\u003e\n        \u003clabel\u003eName:\u003c/label\u003e\n        \u003cinput type=\"text\" {...bind('name')} /\u003e\n        {errors.name \u0026\u0026 \u003cspan style={{ color: 'red' }}\u003e{errors.name}\u003c/span\u003e}\n      \u003c/div\u003e\n      \u003cdiv\u003e\n        \u003clabel\u003eEmail:\u003c/label\u003e\n        \u003cinput type=\"email\" {...bind('email')} /\u003e\n        {errors.email \u0026\u0026 \u003cspan style={{ color: 'red' }}\u003e{errors.email}\u003c/span\u003e}\n      \u003c/div\u003e\n      \u003cdiv\u003e\n        \u003clabel\u003eAge:\u003c/label\u003e\n        \u003cinput type=\"number\" {...bind('user.age')} /\u003e\n        {errors['user.age'] \u0026\u0026 \u003cspan style={{ color: 'red' }}\u003e{errors['user.age']}\u003c/span\u003e}\n      \u003c/div\u003e\n      \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n    \u003c/form\u003e\n  );\n};\n\nexport default MyForm;\n```\n\n### JavaScript Example\n\n```jsx\nimport React from 'react';\nimport { useFormBinder } from '@yourusername/react-form-binder';\n\nconst MyForm = () =\u003e {\n  const initialValues = { name: '', email: '', user: { age: 0 } };\n\n  const validators = {\n    name: (value) =\u003e (value.trim() === '' ? 'Name is required' : undefined),\n    email: (value) =\u003e (/\\S+@\\S+\\.\\S+/.test(value) ? undefined : 'Invalid email address'),\n    'user.age': (value) =\u003e (value \u003c 18 ? 'Age must be at least 18' : undefined),\n  };\n\n  const { values, errors, bind, validate } = useFormBinder(initialValues, validators);\n\n  const handleSubmit = (e) =\u003e {\n    e.preventDefault();\n    if (validate()) {\n      console.log('Form submitted:', values);\n    } else {\n      console.log('Validation errors:', errors);\n    }\n  };\n\n  return (\n    \u003cform onSubmit={handleSubmit}\u003e\n      \u003cdiv\u003e\n        \u003clabel\u003eName:\u003c/label\u003e\n        \u003cinput type=\"text\" {...bind('name')} /\u003e\n        {errors.name \u0026\u0026 \u003cspan style={{ color: 'red' }}\u003e{errors.name}\u003c/span\u003e}\n      \u003c/div\u003e\n      \u003cdiv\u003e\n        \u003clabel\u003eEmail:\u003c/label\u003e\n        \u003cinput type=\"email\" {...bind('email')} /\u003e\n        {errors.email \u0026\u0026 \u003cspan style={{ color: 'red' }}\u003e{errors.email}\u003c/span\u003e}\n      \u003c/div\u003e\n      \u003cdiv\u003e\n        \u003clabel\u003eAge:\u003c/label\u003e\n        \u003cinput type=\"number\" {...bind('user.age')} /\u003e\n        {errors['user.age'] \u0026\u0026 \u003cspan style={{ color: 'red' }}\u003e{errors['user.age']}\u003c/span\u003e}\n      \u003c/div\u003e\n      \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n    \u003c/form\u003e\n  );\n};\n\nexport default MyForm;\n```\n\n## Contributing\n\nContributions are welcome! Feel free to submit issues or pull requests to improve the project.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhesh-10%2Freact-form-binder-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddhesh-10%2Freact-form-binder-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhesh-10%2Freact-form-binder-2/lists"}