Reactjs 将URL参数和道具传递给Route';s渲染组件
在Reactjs 将URL参数和道具传递给Route';s渲染组件,reactjs,react-router,Reactjs,React Router,在react router中,要访问URL参数,必须使用的组件道具: <Route path="/articles/:id" component={Article} /> //Then use the injected this.props.match.params.id to retrieve the id <Route path="/articles" render={() => <PageArticles width={200} />} />
react router
中,要访问URL参数,必须使用
的组件道具:
<Route path="/articles/:id" component={Article} />
//Then use the injected this.props.match.params.id to retrieve the id
<Route path="/articles" render={() => <PageArticles width={200} />} />
但是如何将URL参数和道具同时传递给呈现组件呢
感谢您的帮助。渲染道具的功能在签名中包含路由道具:
<Route path="/articles" render{
(routeParams) => <PageArticles routeParams={routeParams} width={200} />
}/>
}/>
你可以在我的作品中看到