框架
版本

安装

你可以使用任何 NPM 包管理器安装 TanStack Router。

sh
npm install @tanstack/react-router
# or
pnpm add @tanstack/react-router
# or
yarn add @tanstack/react-router
# or
bun add @tanstack/react-router
# or
deno add npm:@tanstack/react-router
npm install @tanstack/react-router
# or
pnpm add @tanstack/react-router
# or
yarn add @tanstack/react-router
# or
bun add @tanstack/react-router
# or
deno add npm:@tanstack/react-router

TanStack Router 目前仅兼容 React (使用 ReactDOM) 和 Solid。如果您想为 React Native、Angular 或 Vue 适配器做出贡献,请在 Discord 上联系我们。

要求

  • react v18.x.x 或 v19.x.x
  • react-dom, v18.x.x 或 v19.x.x
    • 请注意,需要 ReactDOM.createRoot
    • 不支持旧的 .render() 函数。

TypeScript 是可选的,但强烈推荐!如果您正在使用它,请确保您使用的是 typescript>=v5.3.x

重要提示

我们的目标是支持 TypeScript 最近五个次要版本。如果您使用的是较旧的版本,您可能会遇到问题。请升级到最新版本的 TypeScript 以确保兼容性。我们可能会在次要版本或补丁版本中,在没有警告的情况下,放弃对上述范围之外的旧版本 TypeScript 的支持。

订阅 Bytes

您每周的 JavaScript 新闻。每周一免费发送给超过 10 万名开发者。

Bytes

无垃圾邮件。随时取消订阅。