{"id":13481440,"url":"https://github.com/JedWatson/react-value","last_synced_at":"2025-03-27T12:30:50.058Z","repository":{"id":57347328,"uuid":"114248745","full_name":"JedWatson/react-value","owner":"JedWatson","description":"Adding Value to React","archived":false,"fork":false,"pushed_at":"2019-05-08T22:08:31.000Z","size":113,"stargazers_count":91,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T13:26:38.035Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/JedWatson.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}},"created_at":"2017-12-14T12:36:54.000Z","updated_at":"2023-05-18T21:04:05.000Z","dependencies_parsed_at":"2022-08-28T03:52:02.317Z","dependency_job_id":null,"html_url":"https://github.com/JedWatson/react-value","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JedWatson%2Freact-value","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JedWatson%2Freact-value/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JedWatson%2Freact-value/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JedWatson%2Freact-value/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JedWatson","download_url":"https://codeload.github.com/JedWatson/react-value/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245844827,"owners_count":20681786,"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":[],"created_at":"2024-07-31T17:00:51.818Z","updated_at":"2025-03-27T12:30:49.679Z","avatar_url":"https://github.com/JedWatson.png","language":"JavaScript","funding_links":[],"categories":["Components"],"sub_categories":["Data"],"readme":"# react-value\n\nAn easy easy way to wrap controlled components that provide `value` and `onChange` props with state.\n\nMakes your components behave like React input components.\n\n## Install\n\n```\nyarn add react-value\n```\n\n## Use\n\nYou can either use the `Value` component, which takes a `render` prop:\n\n```jsx\nimport { Value } from 'react-value';\n\n\u003cValue\n  defaultValue={defaultValue} // optional\n  onChange={newValue =\u003e null} // optional\n  render={(value, onChange) =\u003e \u003cMyInput onChange={onChange} value={value} /\u003e}\n/\u003e;\n```\n\n..or for repeated use, you can use the `withValue` HOC:\n\n```jsx\nimport { withValue } from 'react-value';\n\nconst MyInputWithValue = withValue(MyInput);\n\n\u003cMyInputWithValue defaultValue=\"Hello World\" /\u003e;\n```\n\n### Custom Prop Names\n\nIf you want to use the HOC but the component you're wrapping uses different props for `value` and `onChange`, you can map them using the second options argument. For example, if the component expects `onValueUpdated` and `currentValue` props:\n\n```jsx\nimport { withValue } from 'react-value';\n\nconst MyInputWithValue = withValue(MyInput, {\n  onChangeProp: 'onValueUpdated',\n  valueProp: 'currentValue',\n});\n\n\u003cMyInputWithValue defaultValue=\"Hello World\" /\u003e;\n```\n\n# License\n\nCopyright (c) 2018 Jed Watson. MIT Licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJedWatson%2Freact-value","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJedWatson%2Freact-value","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJedWatson%2Freact-value/lists"}