# @tarojs/router

> Taro-router

Latest version **4.2.1** (published 2026-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tarojs/router
pnpm add @tarojs/router
yarn add @tarojs/router
bun add @tarojs/router
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.2.1 |
| Published | 2026-07-17 |
| First published | 2018-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 18 |
| Dependencies | 6 |
| Unpacked size | 253.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 37680 |
| Author | O2Team |
| Maintainers | yuche, xuanzebin, defaultlee, drchan, kyjo, qq592743779, advancedcat, baosiqing, zakary, liuzejia, vasily.cjj, hardenzheng2 |
| Keywords | router |

## Links

- npm: https://www.npmjs.com/package/@tarojs/router
- Repository: https://github.com/NervJS/taro
- Homepage: https://github.com/NervJS/taro#readme
- Issues: https://github.com/NervJS/taro/issues
- npm.io page: https://npm.io/package/@tarojs/router

## Dependencies (6)

- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [history](https://npm.io/package/history.md) ^5.3.0
- [query-string](https://npm.io/package/query-string.md) ^9.0.0
- [mobile-detect](https://npm.io/package/mobile-detect.md) ^1.4.2
- [dingtalk-jsapi](https://npm.io/package/dingtalk-jsapi.md) ~2.15.2
- [universal-router](https://npm.io/package/universal-router.md) ^9.2.0

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 4.2.1 (latest) — 2026-07-17
- 4.2.2-beta.5 (beta) — 2026-09-14
- 4.2.2-alpha.2 (alpha) — 2026-09-01
- 3.6.40 (v3-latest) — 2026-04-13
- 3.6.40-beta.1 (v3-beta) — 2026-03-25
- 4.0.9-alpha.8 (test) — 2025-05-14
- 4.0.7-canary.6 (canary) — 2024-11-12
- 4.0.2 (next) — 2024-07-16
- 3.6.15-theta.0 (theta) — 2024-05-06
- 3.6.24-nightly.10 (nightly) — 2024-02-28
- 2.2.22 (2.x) — 2024-01-09
- 3.0.29 (3.0) — 2021-03-09
- 1.3.46 (1.x) — 2020-10-21
- 0.0.0-experimental.2 (experimental) — 2020-04-27
- 4.2.2-beta.4 — 2026-09-08
- … 1175 more at https://npm.io/package/@tarojs/router/versions

## README

# `@tarojs/router`

H5 端路由系统。

## 核心 API

### createRouter(app, config, type, framework, reactDOM)

暴露给 `@tarojs/taro-loader/h5` 调用，在应用入口文件中调用，创建一个兼容小程序路由规范的应用。

#### 参数

#### `app`

入口文件默认导出的组件

#### `config`

应用全局配置及页面配置。对应 `app.config.js` 及 `page.config.js` 的返回内容。

#### `type`

框架类型，`react` | `vue` | `solid` | `preact` 四选一。

#### `framework`

框架的 default import 对象。

### `reactDOM`

可选，`react-dom` 的 default import 对象。

---
_Source: https://npm.io/package/@tarojs/router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
