Answers for "react router 404"

3

react router catch all 404

<Switch>
   <Route path="/" exact component={Home}/>
   <Route path="/about" component={About}/>
   <Route component={Page404} />
</Switch>
Posted by: Guest on November-25-2020
2

react router 404 redirect

<Route path='*' exact={true} component={My404Component} />
 // Or don't mention path
<Route component={My404Component} />
Posted by: Guest on June-11-2020
1

404 error react router

import React from 'react';
import { render } from 'react-dom';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';

import Hello from './Hello';
import NotFound from './NotFound';

const App = () => (
  <Router>
    <Switch>
      <Route exact path="/" component={Hello} />
      <Route component={NotFound} />
    </Switch>
  </Router>
);

render(<App />, document.getElementById('root'));
Posted by: Guest on July-07-2021
1

react router 404

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]
</IfModule>
Posted by: Guest on July-09-2021
0

route with parameter react not working not found

<div>
    <Router history={browserHistory}>
        <Route path="/" component={NewCustomerContainer} />
        <Route path="/newCustomer" component={NewCustomerContainer} />
        <Route path="/search" component={SearchPageContainer} />
        <Route path="/network" component={NetworkMetaContainer}>
            <Route path="/:id" component={NetworkContainer}/>
        </Route>
    </Router>
</div>
Posted by: Guest on November-25-2020

Browse Popular Code Answers by Language