Created
November 26, 2019 02:41
-
-
Save alejovdev/2a8dab7157e8c5239219e55c0159ba7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
import { BrowserRouter, Switch, Route, Link } from "react-router-dom"; | |
// Import Helmet | |
import Helmet from "react-helmet"; | |
function Config({}) { | |
return ( | |
<div className="config"> | |
{/* Add a Helmet tag with the title tag inside */} | |
<Helmet> | |
<title>MyApp | Config</title> | |
</Helmet> | |
<h1>Config</h1> | |
<Link to="/">Todos</Link> | |
</div> | |
); | |
} | |
function Todos({}) { | |
return ( | |
<div className="todos"> | |
{/* Same here */} | |
<Helmet> | |
<title>MyApp | Todos</title> | |
</Helmet> | |
<h1>Todos</h1> | |
<Link to="/config">Config</Link> | |
</div> | |
); | |
} | |
function App({}) { | |
return ( | |
<div className="app"> | |
<BrowserRouter> | |
<Switch> | |
<Route path="/config" render={props => <Config {...props} />} /> | |
<Route path="/" render={props => <Todos {...props} />} /> | |
</Switch> | |
</BrowserRouter> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment