Skip to content

Instantly share code, notes, and snippets.

@alejovdev
Created November 26, 2019 02:41
Show Gist options
  • Save alejovdev/2a8dab7157e8c5239219e55c0159ba7c to your computer and use it in GitHub Desktop.
Save alejovdev/2a8dab7157e8c5239219e55c0159ba7c to your computer and use it in GitHub Desktop.
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