@getaround-eu/use-route-params

中文文档
1.0.4发布于 2023/01/05MITTypeScriptESM + CJS零依赖近 30 天下载 2041

从路由中获取已键入参数的钩子

中文使用文档
文档目录4 节
  1. 这是什么?
  2. 安装
  3. 使用量
  4. 什么是Getaround吗?

@ getaund- eu/ use- route- params (英语)

从路径中获取您的参数

这是什么?

useRouteParams 是一个钩子,用来 react-router-dom v6,允许您直接从提供的路由路径获取已键入的参数.

安装

假设你 已经 react-router-dom 已安装数字 :

yarn add @getaround-eu/use-route-params
# or
npm -i @getaround-eu/use-route-params

使用量

import useRouteParams from "@getaround-eu/use-route-params"

const MY_COMPONENT_PATH = "/here/:is/:a/route/toMyComponent"


const MyComponent = () => {
  const { a, is } = useRouteParams(MY_COMPONENT_PATH)

  return (...)
}

// This way the route is always bound to the component
MyComponent.routePath = MY_COMPONENT_PATH

export default MyComponent

什么是Getaround吗?

绕道将安全、方便和负担得起的汽车与需要他们生活和工作的人连接起来. 我们的目标是创造世界最好的汽车共享市场 让共享的车辆比拥有它们更好我们的社区包括依靠我们的汽车进行需求流动的人,以及在我们的平台上共用汽车的业主,包括经营自己的汽车共享业务的人.

我们的愿景是使我们的城市和社区拥有更好的生活环境:

  • 增强人们的能力,方便地使用他们需要的汽车,无论何时需要这些汽车.
  • 通过缓解拥堵,使公交更加便捷使用来改善流动性.
  • 通过减少污染和推进可持续能源来保护我们的环境.

作为提醒,在大多数国家最大的碳排放者是汽车, 这就是我们在Getaround的影响.

你们可以 在科技博客上更多地了解Getround。 。 。 .

版本与发布记录

@getaround-eu/use-route-params 共发布 6 个版本,首次发布于 2022/07/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.4latest2023/01/053 年前
1.0.32022/07/124 年前
1.0.22022/07/124 年前
1.0.12022/07/124 年前
1.0.02022/07/124 年前
0.1.02022/07/114 年前

关于 @getaround-eu/use-route-params 的常见问题

@getaround-eu/use-route-params 是什么?

从路由中获取已键入参数的钩子

如何安装 @getaround-eu/use-route-params?

在项目目录运行 npm install @getaround-eu/use-route-params,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react-router-dom(^6.3.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@getaround-eu/use-route-params 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@getaround-eu/use-route-params 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@getaround-eu/use-route-params 可以商用吗?

@getaround-eu/use-route-params 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@getaround-eu/use-route-params 的下载量有多少?

根据 npm 官方下载统计,@getaround-eu/use-route-params 在 2026/10/17 – 2026/11/15 这 30 天内被下载 2,041 次,日均约 68 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@getaround-eu/use-route-params 还在维护吗?

最新版本 1.0.4 发布于 2023/01/05(3 年前);至今共发布 6 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/07/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。