Tuomas Toivonen
Tuomas Toivonen

Reputation: 23502

How to update page with react-router-component

I'm using react-router-component (not react-router) to handle routing in my single page application. Refreshing the page or typing route manually in address bar results in page not found. How to handle the refresh and navigation by address in react-router-component?

Upvotes: 2

Views: 222

Answers (1)

Christopher Chiche
Christopher Chiche

Reputation: 15335

By default the server will look for an html file at the route it receives. So you should configure it for html5 navigation to return you index.html for any route it receives.

For example with webpack-dev-server, you can add this to your webpack dev server config:

historyApiFallback: true 

Upvotes: 1

Related Questions