Skip to content

Instantly share code, notes, and snippets.

@jmfurlott
Last active September 28, 2015 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmfurlott/4ca1dc14aebb49d3f96b to your computer and use it in GitHub Desktop.
Save jmfurlott/4ca1dc14aebb49d3f96b to your computer and use it in GitHub Desktop.
IndexRoute issues with react-router
const routes = (
<Route component={ App } path="/">
<Route component={ Child } path="child/:id">
<Route component={ GrandChild } path="grandchild" />
<IndexRoute component={ IndexGrandChild } />
</Route>
</Route>
);
// ...
// In a component, which should I use?
<IndexLink to={ `child/${ id }` } />
// or
<Link to={ `child/${ id }` />
// Using IndexLink does not render any links, where as Link does and works.
// Getting strange errors with Link `Cannot read property '_currentElement' of null`
// when I try use *other* Links
@ryanflorence
Copy link

Either usage is "correct".

Given this url:

child/123

Both links should be "active"

but at child/123/grandchild IndexLink should not be active, but Link still will.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment