@ 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。 。 。 .