{"id":20419295,"url":"https://github.com/nooooooom/vue-forward-ref","last_synced_at":"2025-04-12T17:40:53.740Z","repository":{"id":65676849,"uuid":"597130538","full_name":"nooooooom/vue-forward-ref","owner":"nooooooom","description":"💫 Make it easier for HOCs to forward refs","archived":false,"fork":false,"pushed_at":"2023-10-12T12:43:10.000Z","size":88,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T11:47:24.099Z","etag":null,"topics":["forward-ref","hoc","vue"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/vue-forward-ref","language":"TypeScript","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/nooooooom.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,"governance":null}},"created_at":"2023-02-03T17:40:12.000Z","updated_at":"2023-03-12T12:03:40.000Z","dependencies_parsed_at":"2023-10-12T21:42:39.187Z","dependency_job_id":null,"html_url":"https://github.com/nooooooom/vue-forward-ref","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"64bfab0ccb9ea23830b97af96b35effc8e77f561"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooooooom%2Fvue-forward-ref","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooooooom%2Fvue-forward-ref/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooooooom%2Fvue-forward-ref/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nooooooom%2Fvue-forward-ref/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nooooooom","download_url":"https://codeload.github.com/nooooooom/vue-forward-ref/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248607600,"owners_count":21132571,"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":["forward-ref","hoc","vue"],"created_at":"2024-11-15T06:36:32.536Z","updated_at":"2025-04-12T17:40:53.698Z","avatar_url":"https://github.com/nooooooom.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-forward-ref\r\n\r\n\u003ca href=\"https://npmjs.com/package/vue-forward-ref\"\u003e\u003cimg src=\"https://badgen.net/npm/v/vue-forward-ref?color=blue\" alt=\"npm package\"\u003e\u003c/a\u003e\r\n\r\n💫 Make it easier for HOCs to forward refs.\r\n\r\n## Installation\r\n\r\n```bash\r\npnpm install vue-forward-ref\r\n```\r\n\r\n## Usage\r\n\r\n`vue-forward-ref` provides two forwarding methods.\r\n\r\nThe easiest is to use `forwardRef` to wrap the component you need to forward.\r\n\r\n```js\r\nimport { forwardRef } from 'vue-forward-ref'\r\n\r\ndefineComponent({\r\n  name: 'Wrapper',\r\n  setup() {\r\n    return () =\u003e {\r\n      // The component can be any type used to create a vnode\r\n      // - string\r\n      // - Component\r\n      // - ConcreteComponent\r\n      return forwardRef('div')\r\n    }\r\n  }\r\n})\r\n```\r\n\r\nIf you need to extend or override the forward, you can use `createForwardRef`.\r\n\r\n```js\r\nimport { createForwardRef } from 'vue-forward-ref'\r\n\r\ndefineComponent({\r\n  name: 'Wrapper',\r\n  setup() {\r\n    const override = {\r\n      // ...\r\n    }\r\n    // Assign `forwardRef` to the component that needs to be forwarded,\r\n    // and the first parameter allows you to pass in the ref already defined\r\n    const forwardRef = createForwardRef(null, override)\r\n\r\n    return () =\u003e {\r\n      return h(Component, {\r\n        ref: forwardRef\r\n      })\r\n    }\r\n  }\r\n})\r\n```\r\n\r\nEither way, they allow you to customize which component the declaration is forwarded on.\r\n\r\n```js\r\nforwardRef(Component, instance)\r\n// or\r\ncreateForwardRef(null, null, instance)\r\n```\r\n\r\n## License\r\n\r\n[MIT](./LICENSE)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnooooooom%2Fvue-forward-ref","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnooooooom%2Fvue-forward-ref","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnooooooom%2Fvue-forward-ref/lists"}