|
1 | 1 | import React, { Component } from "react"; |
2 | 2 | import axios from "axios"; |
3 | | -import { Route, Switch } from "react-router-dom"; |
| 3 | +import { Route, Routes } from "react-router-dom"; |
| 4 | +import Modal from "react-modal"; |
4 | 5 |
|
5 | | -import AddUser from "./components/AddUser"; |
6 | 6 | import About from "./components/About"; |
| 7 | +import AddUser from "./components/AddUser"; |
7 | 8 | import LoginForm from "./components/LoginForm"; |
8 | 9 | import Message from "./components/Message"; |
9 | | -import Modal from "react-modal"; |
10 | 10 | import NavBar from "./components/NavBar"; |
11 | 11 | import RegisterForm from "./components/RegisterForm"; |
12 | 12 | import UsersList from "./components/UsersList"; |
@@ -39,9 +39,9 @@ class App extends Component { |
39 | 39 | }; |
40 | 40 | } |
41 | 41 |
|
42 | | - componentDidMount = () => { |
| 42 | + componentDidMount() { |
43 | 43 | this.getUsers(); |
44 | | - }; |
| 44 | + } |
45 | 45 |
|
46 | 46 | addUser = (data) => { |
47 | 47 | axios |
@@ -191,11 +191,11 @@ class App extends Component { |
191 | 191 | <div className="columns"> |
192 | 192 | <div className="column is-half"> |
193 | 193 | <br /> |
194 | | - <Switch> |
| 194 | + <Routes> |
195 | 195 | <Route |
196 | 196 | exact |
197 | 197 | path="/" |
198 | | - render={() => ( |
| 198 | + element={ |
199 | 199 | <div> |
200 | 200 | <h1 className="title is-1">Users</h1> |
201 | 201 | <hr /> |
@@ -237,42 +237,42 @@ class App extends Component { |
237 | 237 | isAuthenticated={this.isAuthenticated} |
238 | 238 | /> |
239 | 239 | </div> |
240 | | - )} |
| 240 | + } |
241 | 241 | /> |
242 | | - <Route exact path="/about" component={About} /> |
| 242 | + <Route exact path="/about" element={<About />} /> |
243 | 243 | <Route |
244 | 244 | exact |
245 | 245 | path="/register" |
246 | | - render={() => ( |
| 246 | + element={ |
247 | 247 | <RegisterForm |
248 | 248 | // eslint-disable-next-line react/jsx-handler-names |
249 | 249 | handleRegisterFormSubmit={this.handleRegisterFormSubmit} |
250 | 250 | isAuthenticated={this.isAuthenticated} |
251 | 251 | /> |
252 | | - )} |
| 252 | + } |
253 | 253 | /> |
254 | 254 | <Route |
255 | 255 | exact |
256 | 256 | path="/login" |
257 | | - render={() => ( |
| 257 | + element={ |
258 | 258 | <LoginForm |
259 | 259 | // eslint-disable-next-line react/jsx-handler-names |
260 | 260 | handleLoginFormSubmit={this.handleLoginFormSubmit} |
261 | 261 | isAuthenticated={this.isAuthenticated} |
262 | 262 | /> |
263 | | - )} |
| 263 | + } |
264 | 264 | /> |
265 | 265 | <Route |
266 | 266 | exact |
267 | 267 | path="/status" |
268 | | - render={() => ( |
| 268 | + element={ |
269 | 269 | <UserStatus |
270 | 270 | accessToken={this.state.accessToken} |
271 | 271 | isAuthenticated={this.isAuthenticated} |
272 | 272 | /> |
273 | | - )} |
| 273 | + } |
274 | 274 | /> |
275 | | - </Switch> |
| 275 | + </Routes> |
276 | 276 | </div> |
277 | 277 | </div> |
278 | 278 | </div> |
|
0 commit comments