-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
34 lines (32 loc) · 815 Bytes
/
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
import React, { useState } from "react";
import "./App.css";
import Sidebar from "../../Sidebar";
import Chat from "../../Chat";
import Login from "../../Login";
import { useStateValue } from "../../StateProvider";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
function App() {
const [{user}, dispatch] = useStateValue();
return (
<div className="app">
{!user ? (
<Login />
) : (
<div className="app__body">
<Router>
<Sidebar />
<Switch>
<Route path="/rooms/:roomId">
<Chat />
</Route>
<Route path="/">
<Chat />
</Route>
</Switch>
</Router>
</div>
)}
</div>
);
}
export default App;