-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathMain.js
More file actions
42 lines (32 loc) · 1.02 KB
/
Main.js
File metadata and controls
42 lines (32 loc) · 1.02 KB
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
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from "react-redux";
import {
BrowserRouter as Router,
Route, Switch
} from "react-router-dom";
import { reload } from '../redux/actions';
import Home from './Home';
import Add from './link/Add';
import MainLink from './link/Main';
import Navbar from './utils/Navbar';
import NotFound from './utils/NotFound';
export default function Main() {
const isAuthenticated = useSelector(state => state.userState.isAuthenticated)
const dispatch = useDispatch();
useEffect(() => {
dispatch(reload())
}, [])
return (
<Router>
<div>
<Navbar />
<Switch>
<Route exact path="/" component={Home} />
<Route exact path="/add" component={Add} />
<Route exact path="/link/:email" component={MainLink} />
<Route component={NotFound}/>
</Switch>
</div>
</Router>
)
}