{"id":15396991,"url":"https://github.com/ryanhefner/use-ref-map","last_synced_at":"2025-04-04T22:41:53.105Z","repository":{"id":57388358,"uuid":"327725995","full_name":"ryanhefner/use-ref-map","owner":"ryanhefner","description":"🪝 Dynamically generate and reference React reference instances with this handy hook.","archived":false,"fork":false,"pushed_at":"2021-01-08T05:31:03.000Z","size":272,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T06:35:30.976Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.pkgstats.com/pkg:use-ref-map","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/ryanhefner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"ryanhefner","patreon":"ryanhefner","open_collective":"ryanhefner","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-01-07T21:12:41.000Z","updated_at":"2024-11-23T19:52:56.000Z","dependencies_parsed_at":"2022-09-09T16:43:55.164Z","dependency_job_id":null,"html_url":"https://github.com/ryanhefner/use-ref-map","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Fuse-ref-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Fuse-ref-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Fuse-ref-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Fuse-ref-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanhefner","download_url":"https://codeload.github.com/ryanhefner/use-ref-map/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247261584,"owners_count":20910107,"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-10-01T15:35:39.775Z","updated_at":"2025-04-04T22:41:53.087Z","avatar_url":"https://github.com/ryanhefner.png","language":"JavaScript","readme":"# 🪝 use-ref-map\n\n[![npm](https://img.shields.io/npm/v/use-ref-map?style=flat-square)](https://www.pkgstats.com/pkg:use-ref-map)\n[![NPM](https://img.shields.io/npm/l/use-ref-map?style=flat-square)](LICENSE)\n[![npm](https://img.shields.io/npm/dt/use-ref-map?style=flat-square)](https://www.pkgstats.com/pkg:use-ref-map)\n\nDynamically generate and reference React reference instances with this handy hook.\n\n## Install\n\nVia [npm](https://npmjs.com/package/use-ref-map)\n\n```sh\nnpm install use-ref-map\n```\n\nVia [Yarn](https://yarn.pm/use-ref-map)\n\n```sh\nyarn add use-ref-map\n```\n\n## How to use\n\n```\nimport useRefMap from 'use-ref-map`\n\nconst ExampleComponent = ({ buttonData }) =\u003e {\n  const { getRef, setRef } = useRefMap()\n\n  const handleSubmit = (evt) =\u003e {\n    evt.preventDefault()\n\n    const email = getRef('email_input')?.current?.value\n    const password = getRef('password_input')?.current?.value\n  }\n\n  return (\n    \u003cform onSubmit={handleSubmit}\u003e\n      \u003cinput type=\"email\" ref={setRef('email_input')} /\u003e\n      \u003cinput type=\"password\" ref={setRef('password_input')} /\u003e\n    \u003c/form\u003e\n  )\n}\n```\n_This is a silly example, but should give you an idea of how to use this hook. This is most useful when dealing with an array of components that require unique `ref` instance props passed to each, using an example key of something like, `dynamic-ref-${id}`._\n\n## License\n\n[MIT](LICENSE) © [Ryan Hefner](https://www.ryanhefner.com)\n","funding_links":["https://github.com/sponsors/ryanhefner","https://patreon.com/ryanhefner","https://opencollective.com/ryanhefner"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanhefner%2Fuse-ref-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanhefner%2Fuse-ref-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanhefner%2Fuse-ref-map/lists"}