Last active
September 28, 2015 19:41
-
-
Save jmfurlott/4ca1dc14aebb49d3f96b to your computer and use it in GitHub Desktop.
IndexRoute issues with react-router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Either usage is "correct".
Given this url:
child/123
Both links should be "active"
but at
child/123/grandchild
IndexLink
should not be active, butLink
still will.