{"id":21284984,"url":"https://github.com/native-router/core","last_synced_at":"2025-03-15T15:11:43.136Z","repository":{"id":193971702,"uuid":"689820074","full_name":"native-router/core","owner":"native-router","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-25T01:52:14.000Z","size":346,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T05:14:30.755Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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}},"created_at":"2023-09-11T01:10:50.000Z","updated_at":"2023-09-11T01:27:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"ce48fe28-aec3-4f9f-b726-18d2d68885a0","html_url":"https://github.com/native-router/core","commit_stats":null,"previous_names":["native-router/core"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Fcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Fcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Fcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/native-router%2Fcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/native-router","download_url":"https://codeload.github.com/native-router/core/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243746202,"owners_count":20341203,"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":[],"created_at":"2024-11-21T11:17:45.037Z","updated_at":"2025-03-15T15:11:43.113Z","avatar_url":"https://github.com/native-router.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/@native-router/core.svg)](https://www.npmjs.com/package/@native-router/core)\n[![Build Status](https://github.com/wmzy/@native-router/core/actions/workflows/ci.yml/badge.svg)](https://github.com/wmzy/@native-router/core/actions)\n[![Coverage](https://img.shields.io/codecov/c/github/wmzy/@native-router/core.svg)](https://codecov.io/gh/wmzy/@native-router/core)\n[![install size](https://packagephobia.now.sh/badge?p=@native-router/core)](https://packagephobia.now.sh/result?p=@native-router/core)\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/core\n```\n\n## 使用\n\n```tsx\nimport {View, HistoryRouter as Router} from '@native-router/core';\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://wmzy.github.io/@native-router/core/modules.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnative-router%2Fcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnative-router%2Fcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnative-router%2Fcore/lists"}