{"id":20626713,"url":"https://github.com/coreprocess/use-ref-with-forwarding","last_synced_at":"2026-04-19T05:36:58.303Z","repository":{"id":65472892,"uuid":"593009652","full_name":"coreprocess/use-ref-with-forwarding","owner":"coreprocess","description":"A React hook combining multiple refs into one ref.","archived":false,"fork":false,"pushed_at":"2023-01-31T21:02:09.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-14T15:01:53.496Z","etag":null,"topics":["forwarding","hook","react","react-hook","ref","useref","userefwithforwarding"],"latest_commit_sha":null,"homepage":"","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/coreprocess.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}},"created_at":"2023-01-25T02:13:02.000Z","updated_at":"2023-11-25T00:20:28.000Z","dependencies_parsed_at":"2023-02-16T23:00:37.719Z","dependency_job_id":null,"html_url":"https://github.com/coreprocess/use-ref-with-forwarding","commit_stats":null,"previous_names":["teamrevin/use-ref-with-forwarding"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coreprocess/use-ref-with-forwarding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreprocess%2Fuse-ref-with-forwarding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreprocess%2Fuse-ref-with-forwarding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreprocess%2Fuse-ref-with-forwarding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreprocess%2Fuse-ref-with-forwarding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coreprocess","download_url":"https://codeload.github.com/coreprocess/use-ref-with-forwarding/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreprocess%2Fuse-ref-with-forwarding/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270470057,"owners_count":24589280,"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-14T02:00:10.309Z","response_time":75,"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":["forwarding","hook","react","react-hook","ref","useref","userefwithforwarding"],"created_at":"2024-11-16T13:14:29.013Z","updated_at":"2026-04-19T05:36:58.257Z","avatar_url":"https://github.com/coreprocess.png","language":"TypeScript","readme":"# useRefWithForwarding()\n\n![npm version](https://badgen.net/npm/v/use-ref-with-forwarding?icon=npm\u0026label)\n![GitHub checks](https://badgen.net/github/checks/teamrevin/use-ref-with-forwarding/publish?icon=github\u0026label=GitHub)\n\n`useRefWithForwarding()` is a simple React hook that can be used to combine multiple refs into one ref.\n\n## Installation\n\nUse your favourite manager to install the [package](https://www.npmjs.com/package/use-ref-with-forwarding):\n\n```sh\nyarn add use-ref-with-forwarding\n```\n\n```sh\nnpm install use-ref-with-forwarding --save\n```\n\n## Example\n\n```ts\nimport React, { Ref, useEffect } from \"react\";\nimport { useRefWithForwarding } from \"use-ref-with-forwarding\";\n\nexport function Example({\n    outerRef1,\n    outerRef2,\n}: {\n    outerRef1: Ref\u003cHTMLElement\u003e;\n    outerRef2: Ref\u003cHTMLElement\u003e;\n}) {\n    const innerRef = useRefWithForwarding\u003cHTMLElement | null\u003e(null, [\n        outerRef1,\n        outerRef2,\n    ]);\n\n    useEffect(() =\u003e {\n        console.log(innerRef.current);\n    });\n\n    return \u003cdiv ref={innerRef} /\u003e;\n}\n```\n\n## Reference\n\nThe hook is a generic with the following generic parameter:\n\n-   `Value`: The value type of the reference.\n\nThe hook function accepts the following function parameters:\n\n-   `initialValue: Value`: The value used to initialize the reference.\n-   `refs: (((value: Value) =\u003e void) | { readonly current: Value; } | { current: Value; } | null | undefined)[]`: A list of references to which a reference update is passed.\n\nIt returns a reference object of the following type: `{ (node: Value): void; current: Value; }`\n\n## License\n\nThis library is licensed under the MIT license.\n\n## Contributing\n\nWe welcome contributions to the `use-ref-with-forwarding` library. To contribute, simply open a [pull request](https://github.com/teamrevin/use-ref-with-forwarding/pulls) with your changes.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreprocess%2Fuse-ref-with-forwarding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreprocess%2Fuse-ref-with-forwarding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreprocess%2Fuse-ref-with-forwarding/lists"}