-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
43 lines (37 loc) · 1.45 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, { createContext, useState } from "react";
import "./App.css";
import Navbar from "./Components/Navbar/Navbar";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import Home from "./Components/Home/Home";
import Login from "./Components/Login/Login";
import Booking from "./Components/Booking/Booking";
import BookingList from "./Components/BookingList/BookingList";
import NotFound from "./Components/NotFound/NotFound";
import Blog from "./Components/Blog/Blog";
import Contact from "./Components/Contact/Contact";
import PrivateRoute from "./Components/PrivateRoute/PrivateRoute";
export const UserLoggedIn = createContext();
function App() {
const [loggedIn, setLoggedIn] = useState({});
return (
<UserLoggedIn.Provider value={[loggedIn, setLoggedIn]}>
<div className="app">
<Router>
<Navbar />
<Switch>
<Route exact path="/" component={Home} />
<Route exact path="/login" component={Login} />
<Route exact path="/booking/:routeId" component={Booking} />
<PrivateRoute exact path="/booking/list/:routeId">
<BookingList />
</PrivateRoute>
<Route exact path="/blog" component={Blog} />
<Route exact path="/contact" component={Contact} />
<Route exact path="*" component={NotFound} />
</Switch>
</Router>
</div>
</UserLoggedIn.Provider>
);
}
export default App;