-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoutes.js
36 lines (32 loc) · 1.17 KB
/
Routes.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
import React from "react";
import { HashRouter, Switch, Route } from "react-router-dom";
import App from "./App";
import Navbar from "./components/Navbar";
import PostCreate from "./components/PostCreate";
import PostDetail from "./components/PostDetail";
import PostUpdate from "./components/PostUpdate";
import Login from "./components/Login";
import Register from "./components/Register";
import Profile from "./components/Profile";
const Routes = () => {
const posts = "/posts";
const login = "/login";
const register = "/register";
const profile = "/profile";
return (
<HashRouter>
<Navbar />
<Switch>
<Route exact path={["/", "/home"]} component={App} />
<Route exact path={posts} component={App} />
<Route path={`${posts}/create`} component={PostCreate} />
<Route path={`${posts}/:postId/edit`} component={PostUpdate} />
<Route path={`${posts}/:postId`} component={PostDetail} />
<Route exact path={login} component={Login} />
<Route exact path={register} component={Register} />
<Route exact path={profile} component={Profile} />
</Switch>
</HashRouter>
);
};
export default Routes;