Javascript 如何在reactjs中获取routes中的id

Javascript 如何在reactjs中获取routes中的id,javascript,reactjs,react-router,Javascript,Reactjs,React Router,我必须在我的路线中插入2个id,我必须在我的数据库中插入这两个id,但是第一个path.id未定义 const {params} = this.context.router; const {router} = this.context; const {routes} = router; let {path} = routes[routes.length - 1]; let {form} = this.props.timeline; form.Timeli

我必须在我的路线中插入2个id,我必须在我的数据库中插入这两个id,但是第一个
path.id
未定义

const {params} = this.context.router;
    const {router} = this.context;
    const {routes} = router;
    let {path} = routes[routes.length - 1];
    let {form} = this.props.timeline;

    form.TimelineKey = (params.id);
    form.Link = path.id+ "/" + params.id ;

此处的path.id未定义

const {params} = this.context.router;
    const {router} = this.context;
    const {routes} = router;
    let {path} = routes[routes.length - 1];
    let {form} = this.props.timeline;

    form.TimelineKey = (params.id);
    form.Link = path.id+ "/" + params.id ;
我不知道怎么才能拿到1068。以下是在我的调试器中发生的情况:


所有react路由器参数都可以在
this.props.params
下找到

根据评论中提供的信息,您可以获得如下所示的
时间线
参数:

this.props.params.timeline

因此,您可以:

form.Link = this.props.params.timeline + "/" + this.context.router.id ;

我想你也在用?如果是,请选择哪个版本的“react router”:“^3.0.2”@ChrisCan显示您的路由器配置?至少是它的相关部分。
this.props.params.
-react router v3 docs上的示例->@Chris编辑了这个问题不起作用:(它是说时间线无法确定)您可以控制台记录
this.props.params
并在您的问题中发布准确的输出吗?它说未定义