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
Allow URLs to be skipped from react-router and passed to server #3109
Comments
Out of scope. |
You can do this by just putting that route handler ahead of whatever middleware function handles your router URLs. It'll short circuit and you can avoid the router entirely. |
Is short-circuiting possible in client side route declarations? |
For workaround, one of my friend wrote ServerLink component (shamelessly copied Link code from react-router), and changed onClick code with |
Looking into Link code, found it skips transitioning to next state if target prop is available, and let browser handle it. So, |
Hi all, I'm trying to sort out an issue that's not obvious. I have a number of routes set up like the following:
I also have a few links scattered around my app that look like the following:
my app.js contains:
and index.js contains:
For some reason, people on different machines seem to be getting different behavior. Some people are correctly served Any idea why this would be happening? |
@mateodelnorte Thanks a lot. You decision works for me: |
My wrapper component using @rskumar's answer above, in case it helps anyone.
|
@mateodelnorte Did you ever get to the bottom of your issue above? I have the same thing with one of my endpoints which goes to 404 for some clients. I think it's something to do with service-worker, but im struggling to work it out |
@markptrueman same here :( |
Yup, the obvious one is... using a traditional anchor tag: <a href="/help">Help me!</a>; That will just get you there without any routing magic. |
Well, not if you use a service worker, which serves the index.html for routes it doesn't know. /help/index.html works, but /help is still resolved within the react app :( |
For few scenarios, developer may want to skip react-router from handling some urls and rather refresh from server. Example url - '/help' may be different section than Single page app using React+router.
Clicking '/help' should then skip react-router from matching and transitioning to NotFound, rather should be rendered from server-side.
The text was updated successfully, but these errors were encountered: