首页 > 解决方案 > 如何在 React 中传递这样的 URL 参数?

问题描述

http://localhost:8080/?companyKey=eefef-edd-dd-ddf

我想通过 URL 在我的反应项目中传递公司密钥

我用了这个方法

<Route exact path="/?companyKey=key"component={CompanySelectorFromKey} />

该方法不起作用

标签: reactjsreact-router

解决方案


<Route path='/edit/:id' component={Edit} />

在编辑组件中,您会收到此 ID

let id = props.match.params.id;


推荐阅读