Skip to content

Instantly share code, notes, and snippets.

@bonnie
Created March 31, 2021 17:54
Show Gist options
  • Save bonnie/8cf7f235b630c8314f76f37167b76863 to your computer and use it in GitHub Desktop.
Save bonnie/8cf7f235b630c8314f76f37167b76863 to your computer and use it in GitHub Desktop.
import { Switch, Route, Link } from "react-router-dom";
import Home from "./Home";
import Menus from "./Menus";
import Locations from "./Locations";
import About from "./About";export default function App() {
return (
<div>
<nav>
<Link to="/">Our Restaurant</Link>
<Link to="/menus">Menus</Link>
<Link to="/locations">Locations</Link>
<Link to="/about">About</Link>
</nav>
{/* routing */}
<Switch>
<Route path="/menus" component={Menus} />
<Route path="/locations/:id" component={Locations} />
<Route path="/locations" component={Locations} />
<Route path="/about" component={About} />
<Route path="/" component={Home} />
</Switch>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment