Gregg
Gregg

Reputation: 35904

Child Route with Parent Route Path Parameter

I have the following:

<Route path="things/:id" component={...}>
  <Route path="thing-types" component={…} />
</Route>

When I build the <Link to="thing-types"> I end up with /things/thing-types instead of things/100/thing-types

Upvotes: 0

Views: 198

Answers (1)

Gregg
Gregg

Reputation: 35904

Turns out <Link> isn't as smart as I thought it was. I had to modify to:

<Link to={`/things/${thing.id}/thing-types`}>Thing Types</Link>

Upvotes: 1

Related Questions