嗨,我试图从我的反应路由器访问我的参数但它总是显示我一个空对象。
这是我的代码:
<Switch>
<Route exact path='/' render={(props) => (<PhotoWall {...this.props}/>)}/>
<Route path='/single/:id' render={(props) => (<Single {...this.props}/>)}/>
</Switch>
我可以在react开发工具中看到我的params的价值。但我无法访问this.props.match.params ..
看起来你正在调试Component的状态而不是你正在处理的组件道具(屏幕截图上方有一个State标签)?