-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 redirection doesn't work #955
Comments
Hi @erick2014 the #949 has been merged in To fix this, you can manually apply change to file in https://github.com/chentsulin/electron-react-boilerplate/pull/949/files until 0.11.2 come out. |
@anthonyraymond I actually had tested your changes but I was missing a small part, I didn't realize you had removed the Router component from routes.js file, so I had this:
Instead of this:
Thx for your help @anthonyraymond |
No problem ;) |
The only weird thing that I found after the fix, was when moving the router paths: http://screencast-o-matic.com/watch/cbfto1XoJU the app got in blank and you have to close it and open it again |
It it only happening when changing |
@anthonyraymond in routes.js file, and if u refresh the page you also get a blank page |
@erick2014 if you don't change the |
@anthonyraymond yes man, if I press cmd + r within "/home" page, I got a blank page, looks like we need a way to tell the router what is its root path: this is my routes file:
Also I have noticed if I move the "/" path to the beginning then I trigger a history.push it will not work, so that's why I have "/home" path as my first path. |
@erick2014 IMO the bug comes from your code. I just rebased Did you replace |
haha yes man I did it, well I am not sure if the bug is mine, but I am afraid you need a root path there, because you are changing the page with redux, so if u refresh u will lost the location where u were, well I think, I am not sure, the redirection works, but if u put the /home path as your first path, otherwise it will not work |
Sure you need a root path. But you messed up something because the boilerplate work as expected for me |
@anthonyraymond I didnt change anything from the structure haha |
One of my project is working, and the boilerplate as well.... But yours is not |
I'll figure out what to do later, thx any way |
I finally was able to reproduce. I partially fixed it in #958 (merged in dev-master). BUT having routes defined with Does not work
Work
|
@anthonyraymond that is what I was trying to explain you haha, thx |
Was this fully resolved? |
Not the path order |
@amilajack yep, we are waiting for this pr #958 to be in master branch |
Was merged in |
@amilajack I was waiting for that merge, I've update to v0.11.2, and now I'm able to perform a redirection to /home page and also I can refresh the page with cmd + r and still working, yujuu, thx @anthonyraymond for that update!!! |
Thank @anthonyraymond. He did all the work |
I think the main problem is in "exact" prop: you should pass it to the component, which has path "/" https://reacttraining.com/react-router/web/api/NavLink/exact-bool otherwise the React router will be confused, because a slash is present in every path ... |
I can't perform a redirection using react router, I have added a button which calls history.push, but it doesn't work
I have checked this PR:
#949
But I still not able to redirect to another page, even using the example from the starter kit
The text was updated successfully, but these errors were encountered: