【发布时间】:2022-01-07 15:03:50
【问题描述】:
所以我有这个。 如何从“路径”中获取“:名称”作为参数并将其提供给 BlogPage 组件的字段“somefield”?
<Route
path = "/blog/:name"
element={
<BlogPage
{// how to do this?}
somefield = ?
/>
}
/>
【问题讨论】:
-
我用“window.location.href”解决了这个问题
标签: reactjs react-router