I am not getting the desired result from using react-router-dom for routing in my react application. Here is the issue.
Error:
cannot GET /path
I get this error when I try to access a route other than '/'.
app.js code
import {BrowserRouter, Route, browserHistory} from 'react-router-dom'; class App extends Component{ render(){ return( <BrowserRouter history={browserHistory}> <div> <Route exact path="/" component={Login}/> <Route path="/about" component={About}/> </div> </BrowserRouter> ); } } render(<App/>, document.getElementById("root"));
When I try to access /about, I get that response from the browser.
I have edited my config as seen in other issues. I added
devServer:{ contentBase: DIST_DIR, historyApiFallback: true }
and
webpack.output.publicPath: '/'
Nothing changes. react-router v4.2.2
I am not getting the desired result from using react-router-dom for routing in my react application. Here is the issue.
Error:
cannot GET /pathI get this error when I try to access a route other than '/'.
app.js code
import {BrowserRouter, Route, browserHistory} from 'react-router-dom'; class App extends Component{ render(){ return( <BrowserRouter history={browserHistory}> <div> <Route exact path="/" component={Login}/> <Route path="/about" component={About}/> </div> </BrowserRouter> ); } } render(<App/>, document.getElementById("root"));When I try to access /about, I get that response from the browser.
I have edited my config as seen in other issues. I added
devServer:{ contentBase: DIST_DIR, historyApiFallback: true }and
webpack.output.publicPath: '/'Nothing changes. react-router v4.2.2