Closed dan-gamble closed 9 years ago
which version of React Router are you using? the 1.0.0-rc1 is not using named routes anymore so you would need to specify the path in your <Link to='/YOUR_PATH'>
I'm using: https://github.com/thereactivestack/meteor-react-router/ which seems to require: 'react-router': '1.0.0-rc1',
Is there a reason named routes were removed? I ask because i use Django mainly at the moment which has a function `{% url 'namespace:name' %} which allows me to change paths without breaking my app. Granted paths are rarely changed it's still a nice little feature.
So is the only way to link to Routes via a path?
Have a look at #1840 there is a discussion about maybe bringing them back.
And yes only via path.
That answers the name question at least thank you :) I do like the Named Component method of doing that though and i could go down that route!
Just a case of finding out how to use <Link>
in individual components that don't seem to have access to history
the other question - putting <Link>
in the Message
component works fine for me
I thought that might break it as it looks similar to the code i have at home. When i get home today i'll post my code example and see if that makes more sense, thanks for your help :)
:+1: let me know, closing for now.
Hey, just uploaded my repo :) The Component i was having trouble with was this one: https://github.com/DanGamble89/meteor-webpack-react-kickstart/blob/master/react/index.jsx#L26
That line throws me the error,
@DanGamble89 are you still having issue with it? sorry I forgot to get back to you.
@knowbody I haven't tried it again since i've uploaded it but i'm pretty sure that repo has the bug. I'll be trying it again this week so i'll post back in here with what i find again :)
How would i use a
<Link>
in an component that doesn't seem to be the wrapping<App />
comoponent? I get this error:A <Link> should not be rendered outside the context of history; some features including real hrefs, active styling, and navigation will not function correctly
An example of when i would use this is like: https://github.com/rackt/react-router/blob/master/docs/Introduction.md#adding-more-ui and i would put a
<Link>
inside of the<Message>
component.Also are you able to
<Link toName='nameOfRoute'>
to link to a<Route>
regardless of it's path?