Skip to content

Instantly share code, notes, and snippets.

@buglessir
Created October 28, 2019 09:10
Show Gist options
  • Save buglessir/e8353054f6af80c6f544518a4eeb7db3 to your computer and use it in GitHub Desktop.
Save buglessir/e8353054f6af80c6f544518a4eeb7db3 to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter, Switch, Route, Link } from 'react-router-dom';
const NotFound = () => (
<h1>404 - Page NotFound !</h1>
)
const Home = () => (
<h1>Home</h1>
)
const About = () => (
<h1>About</h1>
)
const App = () => (
<>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about">About</Link>
</li>
<li>
<Link to="/services">Services</Link>
</li>
</ul>
<Switch>
<Route path="/" component={Home} />
<Route path="/about" component={About} />
<Route component={NotFound} />
</Switch>
</>
)
ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById('root')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment