【发布时间】:2018-06-11 07:12:45
【问题描述】:
您好,我正在尝试从我的 react 路由器访问我的参数,但它总是向我显示一个空对象。
这是我的代码:
<Switch>
<Route exact path='/' render={(props) => (<PhotoWall {...this.props}/>)}/>
<Route path='/single/:id' render={(props) => (<Single {...this.props}/>)}/>
</Switch>
【问题讨论】:
-
能否请您发布您用来访问它们的代码?
-
@Cleiton 嘿 cleiton,我像这样访问它:this.props.match.params,我一直在获取 null
标签: reactjs react-router react-redux react-router-redux