{"id":24851917,"url":"https://github.com/moxystudio/next-with-router-ref","last_synced_at":"2026-05-10T16:15:13.859Z","repository":{"id":36426427,"uuid":"224260972","full_name":"moxystudio/next-with-router-ref","owner":"moxystudio","description":"An alternative to Next.js withRouter HOC that supports refs by forwarding them","archived":false,"fork":false,"pushed_at":"2021-12-09T01:17:55.000Z","size":616,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-08T23:01:41.443Z","etag":null,"topics":["forward-ref","next","ref","router","with-router"],"latest_commit_sha":null,"homepage":"","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/moxystudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-11-26T18:35:43.000Z","updated_at":"2020-01-03T10:11:06.000Z","dependencies_parsed_at":"2022-07-15T20:17:15.845Z","dependency_job_id":null,"html_url":"https://github.com/moxystudio/next-with-router-ref","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/moxystudio/next-with-router-ref","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fnext-with-router-ref","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fnext-with-router-ref/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fnext-with-router-ref/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fnext-with-router-ref/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moxystudio","download_url":"https://codeload.github.com/moxystudio/next-with-router-ref/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxystudio%2Fnext-with-router-ref/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269478604,"owners_count":24423911,"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-08T02:00:09.200Z","response_time":72,"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":["forward-ref","next","ref","router","with-router"],"created_at":"2025-01-31T14:27:27.730Z","updated_at":"2026-05-10T16:15:08.839Z","avatar_url":"https://github.com/moxystudio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# next-with-router-ref\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]\n\n[npm-url]:https://npmjs.org/package/@moxy/next-with-router-ref\n[downloads-image]:https://img.shields.io/npm/dm/@moxy/next-with-router-ref.svg\n[npm-image]:https://img.shields.io/npm/v/@moxy/next-with-router-ref.svg\n[travis-url]:https://travis-ci.org/moxystudio/next-with-router-ref\n[travis-image]:https://img.shields.io/travis/moxystudio/next-with-router-ref/master.svg\n[codecov-url]:https://codecov.io/gh/moxystudio/next-with-router-ref\n[codecov-image]:https://img.shields.io/codecov/c/github/moxystudio/next-with-router-ref/master.svg\n[david-dm-url]:https://david-dm.org/moxystudio/next-with-router-ref\n[david-dm-image]:https://img.shields.io/david/moxystudio/next-with-router-ref.svg\n[david-dm-dev-url]:https://david-dm.org/moxystudio/next-with-router-ref?type=dev\n[david-dm-dev-image]:https://img.shields.io/david/dev/moxystudio/next-with-router-ref.svg\n\nAn alternative to Next.js `withRouter` HOC [that supports refs](https://github.com/zeit/next.js/issues/9528) by forwarding them.\n\n\n## Installation\n\n```sh\n$ npm install @moxy/next-with-router-ref\n```\n\nThis library is written in modern JavaScript and is published in both CommonJS and ES module transpiled variants. If you target older browsers please make sure to transpile accordingly.\n\n\n## Usage\n\n```js\nimport React, { Component } from 'react';\nimport withRouterRef from '@moxy/next-with-router-ref';\n\nclass MyComponent extends Component {\n    render() {\n        const { router } = this.props;\n\n        // ...do something with router\n\n        return \u003cdiv\u003eHello\u003c/div\u003e;\n    }\n};\n\nexport default withRouterRef(MyComponent);\n```\n\n...and then refs work as you would expect:\n\n```js\nimport React, { useRef } from 'react';\nimport MyComponent from 'path/to/my-component';\n\nconst MyParentComponent = () =\u003e {\n    const myComponentRef = useRef();\n\n    return \u003cMyComponent ref={ myComponentRef }\u003e;\n};\n\nexport default MyParentComponent;\n```\n\n## Tests\n\n```sh\n$ npm test\n$ npm test -- --watch # during development\n```\n\n\n## License\n\nReleased under the [MIT License](https://www.opensource.org/licenses/mit-license.php).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxystudio%2Fnext-with-router-ref","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoxystudio%2Fnext-with-router-ref","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxystudio%2Fnext-with-router-ref/lists"}