0

I’m using React-router and it works fine while I’m clicking on link buttons, but when I refresh my webpage it does not load what I want.
For instance, I am in localhost/joblist and everything is fine because I arrived here pressing a link. But if I refresh the webpage I get:
Cannot GET /joblist

By default, it didn’t work like this. Initially I had my URL as localhost/#/ and localhost/#/joblist and they worked perfectly fine. But I don’t like this kind of URL, so trying to erase that #, I wrote:
Router.run(routes, Router.HistoryLocation, function (Handler) {
React.render(, document.body);
});

This problem does not happen with localhost/, this one always returns what I want.
This app is single-page, so /joblist doesn’t need to ask anything to any server.
My entire router.
var routes = (





);

Router.run(routes, Router.HistoryLocation, function (Handler) {
React.render(, document.body);
});

Kuldeep Baberwal Changed status to publish January 28, 2025