{"id":13462453,"url":"https://github.com/router5/router5","last_synced_at":"2025-05-14T10:07:33.886Z","repository":{"id":34327177,"uuid":"38246483","full_name":"router5/router5","owner":"router5","description":"Flexible and powerful universal routing solution","archived":false,"fork":false,"pushed_at":"2023-01-07T05:57:10.000Z","size":6968,"stargazers_count":1710,"open_issues_count":104,"forks_count":107,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-12T02:06:08.804Z","etag":null,"topics":["framework-agnostic","functional","javascript","react","reactive-programming","redux","router","routing","universal"],"latest_commit_sha":null,"homepage":"https://router5.js.org","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/router5.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":null,"security":null,"support":null}},"created_at":"2015-06-29T12:28:12.000Z","updated_at":"2025-05-10T05:54:03.000Z","dependencies_parsed_at":"2023-01-15T06:30:33.805Z","dependency_job_id":null,"html_url":"https://github.com/router5/router5","commit_stats":null,"previous_names":[],"tags_count":288,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/router5%2Frouter5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/router5%2Frouter5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/router5%2Frouter5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/router5%2Frouter5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/router5","download_url":"https://codeload.github.com/router5/router5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254119940,"owners_count":22017952,"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":["framework-agnostic","functional","javascript","react","reactive-programming","redux","router","routing","universal"],"created_at":"2024-07-31T12:00:48.090Z","updated_at":"2025-05-14T10:07:33.828Z","avatar_url":"https://github.com/router5.png","language":"TypeScript","funding_links":[],"categories":["Uncategorized","TypeScript","react 相关库","routers (except r-r)"],"sub_categories":["Uncategorized","macros","Animation"],"readme":"# Router5\n\n[![npm version](https://badge.fury.io/js/router5.svg)](http://badge.fury.io/js/router5)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://travis-ci.org/router5/router5.svg)](https://travis-ci.org/router5/router5) [![Join the chat at https://gitter.im/router5/router5](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/router5/router5?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge) [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\n\u003e Official website: [router5.js.org](https://router5.js.org)\n\nrouter5 is a **framework and view library agnostic router**.\n\n- **view / state separation**: router5 processes routing **instructions** and outputs **state** updates.\n- **universal**: works client-side and server-side\n- **simple**: define your routes, start to listen to route changes\n- **flexible**: you have control over transitions and what happens on transitions\n\n```javascript\nimport createRouter from 'router5'\nimport browserPlugin from 'router5-plugin-browser'\n\nconst routes = [\n  { name: 'home', path: '/' },\n  { name: 'profile', path: '/profile' }\n]\n\nconst router = createRouter(routes)\n\nrouter.usePlugin(browserPlugin())\n\nrouter.start()\n```\n\n**With React \\(hooks\\)**\n\n```javascript\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport { RouterProvider, useRoute } from 'react-router5'\n\nfunction App() {\n  const { route } = useRoute()\n\n  if (!route) {\n    return null\n  }\n\n  if (route.name === 'home') {\n    return \u003ch1\u003eHome\u003c/h1\u003e\n  }\n\n  if (route.name === 'profile') {\n    return \u003ch1\u003eProfile\u003c/h1\u003e\n  }\n}\n\nReactDOM.render(\n  \u003cRouterProvider router={router}\u003e\n    \u003cApp /\u003e\n  \u003c/RouterProvider\u003e,\n  document.getElementById('root')\n)\n```\n\n**With observables**\n\nYour router instance is compatible with most observable libraries.\n\n```javascript\nimport { from } from 'rxjs/observable/from'\n\nfrom(router).map(({ route }) =\u003e {\n  /* happy routing */\n})\n```\n\n### Examples\n\n- With React: [`code`](./examples/react) | [`live`](https://codesandbox.io/s/github/router5/router5/tree/master/examples/react)\n\n### Docs\n\n- Introduction\n  - [Why router5?](https://router5.js.org/introduction/why-router5)\n  - [Getting Started](https://router5.js.org/introduction/getting-started)\n  - [Ecosystem](https://router5.js.org/introduction/ecosystem)\n  - [Core concepts](https://router5.js.org/introduction/core-concepts)\n  - [Transition phase](https://router5.js.org/introduction/transition-phase)\n- Guides\n  - [Defining routes](https://router5.js.org/guides/defining-routes)\n  - [Path Syntax](https://router5.js.org/guides/path-syntax)\n  - [Router options](https://router5.js.org/guides/router-options)\n  - [Navigating](https://router5.js.org/guides/navigating)\n  - [In the browser](https://router5.js.org/guides/in-the-browser)\n  - [Observing state](https://router5.js.org/guides/observing-state)\n- Integration\n  - [With React](https://router5.js.org/integration/with-react)\n  - [With Redux](https://router5.js.org/integration/with-redux)\n- Advanced\n  - [Plugins](https://router5.js.org/advanced/plugins)\n  - [Middleware](https://router5.js.org/advanced/middleware)\n  - [Preventing navigation](https://router5.js.org/advanced/preventing-navigation)\n  - [Errors and redirections](https://router5.js.org/advanced/errors-and-redirections)\n  - [Dependency injection](https://router5.js.org/advanced/dependency-injection)\n  - [Loading async data](https://router5.js.org/advanced/loading-async-data)\n  - [Universal routing](https://router5.js.org/advanced/universal-routing)\n  - [Listeners plugin](https://router5.js.org/advanced/listeners-plugin)\n- [API Reference](https://router5.js.org/api-reference)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frouter5%2Frouter5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frouter5%2Frouter5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frouter5%2Frouter5/lists"}