Answer the question
In order to leave comments, you need to log in
How to reopen current React.js route after page reload?
Good afternoon!
React renders on the client, so the question is about client-side routing.
Let's say we followed the link, and we are on the path localhost: 8080/foo<Route path='foo' component={FooBar} />
After reloading the page, we will get a 404 error.
Is it possible, by reloading the page, to open the component along the current path, for example, by redirecting to index.html, and following the link from window.location again? browserHistory.push('/some/path')
Same question if you open the link in a new tab.
Answer the question
In order to leave comments, you need to log in
Do I understand correctly that you have a project where react renders only some of the views? (ie, only some pages?)
In that case, you can make separate builds for each page without using routing at all. Or, why do you need it in this case?
That is: there is an about page in react, make bundle-about.js for it, bundle-contacts.js for contacts in react, and so on.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question