{"id":15020331,"url":"https://github.com/native-router/react","last_synced_at":"2025-10-25T17:30:33.357Z","repository":{"id":57308320,"uuid":"410869748","full_name":"native-router/react","owner":"native-router","description":"A route close to the native experience for react.","archived":false,"fork":false,"pushed_at":"2023-10-17T07:59:13.000Z","size":3375,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T23:13:58.095Z","etag":null,"topics":["async","data-fetching","react","react-router","router","tiny"],"latest_commit_sha":null,"homepage":"https://native-router.github.io/react/","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/native-router.png","metadata":{"files":{"readme":"README-zh_CN.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-27T12:10:27.000Z","updated_at":"2025-05-16T07:29:23.000Z","dependencies_parsed_at":"2023-09-11T03:31:19.651Z","dependency_job_id":"aca8f4a3-c5f2-4991-8555-bf9144a85c43","html_url":"https://github.com/native-router/react","commit_stats":{"total_commits":95,"total_committers":2,"mean_commits":47.5,"dds":"0.010526315789473717","last_synced_commit":"9eb5aa44a55748e6af061baf56cef14531a94f78"},"previous_names":["native-router/react","wmzy/native-router-react"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/native-router/react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Freact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Freact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Freact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Freact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/native-router","download_url":"https://codeload.github.com/native-router/react/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Freact/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280676913,"owners_count":26371834,"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-10-23T02:00:06.710Z","response_time":142,"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":["async","data-fetching","react","react-router","router","tiny"],"created_at":"2024-09-24T19:54:55.357Z","updated_at":"2025-10-25T17:30:32.943Z","avatar_url":"https://github.com/native-router.png","language":"TypeScript","readme":"[![npm](https://img.shields.io/npm/v/@native-router/react.svg)](https://www.npmjs.com/package/@native-router/react)\n[![Build Status](https://github.com/native-router/react/actions/workflows/ci.yml/badge.svg)](https://github.com/native-router/react/actions)\n[![codecov](https://codecov.io/gh/native-router/react/graph/badge.svg?token=QIXC6HJH6Z)](https://codecov.io/gh/native-router/react)\n[![install size](https://packagephobia.now.sh/badge?p=@native-router/react)](https://packagephobia.now.sh/result?p=@native-router/react)\n\n# Native Router React\n\n\u003e 接近原生体验的 React 路由库。\n\n[English](./README.md) | 简体中文\n\n## 特性\n\n- 异步导航\n- 可取消\n- 页面视图和数据并发拉取\n- 链接页面预加载及预览\n- 轻量小巧，Tree-Shaking 友好\n- 支持 TreeShaking\n\n## 安装\n\n```bash\nnpm i @native-router/react\n```\n\n## 使用\n\n```tsx\nimport {View, HistoryRouter as Router} from '@native-router/react';\nimport Loading from '@/components/Loading';\nimport RouterError from '@/components/RouterError';\nimport * as userService from '@/services/user';\n\nexport default function App() {\n  return (\n    \u003cRouter\n      routes={{\n        component: () =\u003e import('./Layout'),\n        children: [\n          {\n            path: '/',\n            component: () =\u003e import('./Home')\n          },\n          {\n            path: '/users',\n            component: () =\u003e import('./UserList'),\n            data: userService.fetchList\n          },\n          {\n            path: '/users/:id',\n            component: () =\u003e import('./UserProfile'),\n            data: ({id}) =\u003e userService.fetchById(+id)\n          },\n          {\n            path: '/help',\n            component: () =\u003e import('./Help')\n          },\n          {\n            path: '/about',\n            component: () =\u003e import('./About')\n          }\n        ]\n      }}\n      baseUrl=\"/demos\"\n      errorHandler={(e) =\u003e \u003cRouterError error={e} /\u003e}\n    \u003e\n      \u003cView /\u003e\n      \u003cLoading /\u003e\n    \u003c/Router\u003e\n  );\n}\n\n```\n\n查看 [完整示例](/demos/)。\n\n## 文档 \n\n[API](https://native-router.github.io/react/modules.html)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnative-router%2Freact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnative-router%2Freact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnative-router%2Freact/lists"}