我有以下内容:
<Route path="things/:id" component={...}>
<Route path="thing-types" component={…} />
</Route>
当我构建<Link to="thing-types">
时,我最终得到/things/thing-types
而不是things/100/thing-types
答案 0 :(得分:1)
原来<Link>
并不像我想象的那么聪明。我不得不修改为:
<Link to={`/things/${thing.id}/thing-types`}>Thing Types</Link>