Created
November 3, 2019 11:31
-
-
Save pubudu-ranasinghe/d4e9c13f7312886299a6354ab648fedf to your computer and use it in GitHub Desktop.
react-context-example-15
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 from "react"; | |
import Todos from "./components/Todos"; | |
import Login from "./components/Login"; | |
import { TodoProvider } from "./contexts/TodoContext"; | |
import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; | |
import "./App.css"; | |
function App() { | |
return ( | |
<Router> | |
<div className="App"> | |
<Greeting /> | |
<Switch> | |
<Route path="/todos"> | |
<TodoProvider> | |
<Todos /> | |
</TodoProvider> | |
</Route> | |
<Route path="/"> | |
<Login /> | |
</Route> | |
</Switch> | |
</div> | |
</Router> | |
); | |
} | |
function Greeting() { | |
return <p>You are not logged in</p>; | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment