Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 将URL参数和道具传递给Route';s渲染组件_Reactjs_React Router - Fatal编程技术网

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} />
}/>

}/>
你可以在我的作品中看到