{"id":19886151,"url":"https://github.com/kyeotic/raviger","last_synced_at":"2025-05-16T00:06:18.211Z","repository":{"id":35029268,"uuid":"197706367","full_name":"kyeotic/raviger","owner":"kyeotic","description":"React routing with hooks","archived":false,"fork":false,"pushed_at":"2025-04-08T16:56:34.000Z","size":7921,"stargazers_count":134,"open_issues_count":1,"forks_count":19,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-19T02:54:49.598Z","etag":null,"topics":["react","react-hooks","routing"],"latest_commit_sha":null,"homepage":"https://kyeotic.github.io/raviger/","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/kyeotic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-07-19T05:16:50.000Z","updated_at":"2025-04-12T21:52:58.000Z","dependencies_parsed_at":"2024-06-18T16:45:37.794Z","dependency_job_id":"04bcdbfb-aaea-472b-a761-5c394df3b2f9","html_url":"https://github.com/kyeotic/raviger","commit_stats":{"total_commits":329,"total_committers":14,"mean_commits":23.5,"dds":0.4984802431610942,"last_synced_commit":"e1fca166244c486a9224327daf3335038320f172"},"previous_names":[],"tags_count":105,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyeotic%2Fraviger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyeotic%2Fraviger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyeotic%2Fraviger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyeotic%2Fraviger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyeotic","download_url":"https://codeload.github.com/kyeotic/raviger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442854,"owners_count":22071878,"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":["react","react-hooks","routing"],"created_at":"2024-11-12T17:36:23.972Z","updated_at":"2025-05-16T00:06:18.192Z","avatar_url":"https://github.com/kyeotic.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raviger\r\n\r\n\u003cp align=\"center\"\u003e\r\n    \u003ca href=\"https://bundlephobia.com/package/raviger@latest\" alt=\"Bundlephobia\"\u003e\r\n        \u003cimg src=\"https://badgen.net/bundlephobia/min/raviger\" /\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://bundlephobia.com/package/raviger@latest\" alt=\"Bundlephobia gzip\"\u003e\r\n        \u003cimg src=\"https://badgen.net/bundlephobia/minzip/raviger\" /\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://github.com/kyeotic/raviger/actions\" alt=\"Builds\"\u003e\r\n        \u003cimg src=\"https://github.com/kyeotic/raviger/workflows/Tests/badge.svg\" /\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n\r\n**R**eact N**avig**at**or**. A React hook-based router that updates on **all** url changes. Heavily inspired by [hookrouter](https://github.com/Paratron/hookrouter).\r\n\r\nZero dependencies. Tiny footprint.\r\n\r\n\u003e Note: Raviger is considered feature complete and will very likely receive only maintainace patches going forward.\r\n\r\n# Installation\r\n\r\n```\r\nnpm i raviger\r\n```\r\n\r\n# Docs\r\n\r\nComplete documentation is available [here on GitHub Pages](https://kyeotic.github.io/raviger/)\r\n\r\n# Quick Start\r\n\r\n```jsx\r\nimport { useRoutes, Link, useQueryParams } from 'raviger'\r\n\r\nconst routes = {\r\n  '/': () =\u003e \u003cHome /\u003e,\r\n  '/about': () =\u003e \u003cAbout /\u003e,\r\n  '/users/:userId': ({ userId }) =\u003e \u003cUser id={userId} /\u003e\r\n}\r\n\r\nexport default function App() {\r\n  let route = useRoutes(routes)\r\n  return (\r\n    \u003cdiv\u003e\r\n      \u003cdiv\u003e\r\n        \u003cLink href=\"/\"\u003eHome\u003c/Link\u003e\r\n        \u003cLink href=\"/about\"\u003eAbout\u003c/Link\u003e\r\n        \u003cLink href=\"/users/1\"\u003eTom\u003c/Link\u003e\r\n        \u003cLink href=\"/users/2\"\u003eJane\u003c/Link\u003e\r\n      \u003c/div\u003e\r\n      {route}\r\n    \u003c/div\u003e\r\n  )\r\n}\r\n```\r\n\r\n## Query Strings\r\n\r\n```javascript\r\nimport { useQueryParams } from 'raviger'\r\n\r\nfunction UserList ({ users }) {\r\n  const [{ startsWith }, setQuery] = useQueryParams()\r\n\r\n  return (\r\n    \u003cdiv\u003e\r\n    \u003clabel\u003e\r\n      Filter by Name\r\n      \u003cinput value={startsWith || ''} onChange={(e) =\u003e setQuery({ startsWith: e.target.value})} /\u003e\r\n    \u003c/label\u003e\r\n    {users.filter(u =\u003e !startsWith || u.name.startsWith(startsWith).map(user =\u003e (\r\n      \u003cp key={user.name}\u003e{user.name}\u003c/p\u003e\r\n    )))}\r\n    \u003c/div\u003e\r\n  )\r\n}\r\n```\r\n\r\n## Navigation\r\n\r\nThe preferred method for navigation is the `\u003cLink\u003e` component, which uses all the same properties as the standard `\u003ca\u003e` element, and requires `href`. Internally `\u003cLink\u003e` uses `history.pushState` to ensure navigation without a page refresh. If you need to perform programmatic navigation raviger exports a `navigate` function.\r\n\r\nSome routing libraries only trigger React component updates if navigation was triggered using specific methods, such as a specific instance of **history**. **raviger** listens for all `popstate` events and checks for changes. You can even have two isolated React instances on a page and URL changes will properly trigger **raviger** hooks.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyeotic%2Fraviger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyeotic%2Fraviger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyeotic%2Fraviger/lists"}