Answer the question
In order to leave comments, you need to log in
How to make NoMatch page on React-Router v4?
Hello, I can't figure out how to fix this situation... When using HashRouter. The NotFound page loads, but it's worth changing to BrowserRouter, as it writes to any incomprehensible url: cannot get / ..
App.jsx
import {
BrowserRouter as Router,
Route,
Switch,
HashRouter
} from 'react-router-dom'
import Main from '../layouts/main/index'
import NotFound from '../layouts/404/index'
export default class App extends Component {
render(){
return<Router>
<Switch>
<Route exact path="/" component = { Main }/>
<Route component = { NotFound }/>
</Switch>
</Router>
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question