-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Router: Linking to Route instead of URL? #14
Comments
Hopefully I'm getting the question right, so please correct me if I misunderstood. You want to be able to change the route string in one place, w/o checking all Let's say you have a module in your app:
Then in your other modules you can:
Is this what you want? |
react-router had a |
As a side advice, I strongly suggest moving to v4. It's just components. Much easier to digest. Versions of RR < 4 have a crappy API. Worse than Nicolas Cage's acting skills. |
Totally agree with RR4, but I haven't found a good solution for the way in which you perform server side rendering with prefetching data with RR < 4. I'm investigating it actually these days :) |
@alexnm the name parameter was exactly what I was looking for, I'll read into the decision to remove it. @r31gn yes, you understood correctly my intent, and your idea might help make it easier to manage Links. However, I was thinking about something that is, in addition to that, correlated with the Route definitions. Also, I'll give v4 a look, thanks for the tip! |
@alexnm It's not straightforward. I bumped into that as well. Also, code splitting + lazy loading with Webpack. Every tutorial you'll find make use of System.import, require.ensure and route hooks (onEnter). These no longer exist in RR 4, so the tutorials are not too helpful. I've wanted to investigate and write an article about this, but had little time. Throw me some resources if you find smth interesting? |
Alright, I am closing this as I have been illuminated :) Since URLs tend to change only at development time, we can muster the courage to manage a few dozen Links across the app, without introducing extra complexity into RR 3. Thanks! |
When using react-router, is there a way to make
<Link>
components that don't have a hardcoded URL in them? e.g. instead of<Link to='/dashboard/projects'>
, have<Link to=' ... projects route... '>
. Or, otherwise, have a way to keep the Route definitions in sync with the various Links floating about in the app.I find it annoying to have to double-check all the Links whenever I shuffle the Route definitions around.
The text was updated successfully, but these errors were encountered: