I am willing to use React-router for my application, and I am trying the example given in the doc first, which I copied below. Now when I go to localhost:3000/
,
If you are using webpack-dev-server
there is an option called history-api-fallback
. If set to true
404s will fallback to /index.html
.
Add the option to devServer
section of the Webpack config like this:
devServer: {
contentBase: 'app/ui/www',
devtool: 'eval',
hot: true,
inline: true,
port: 3000,
outputPath: buildPath,
historyApiFallback: true,
},
Link to Webpack docs: https://webpack.github.io/docs/webpack-dev-server.html