forked from SnakeJenny/FaceDetectSample
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.js
54 lines (49 loc) · 1.28 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
44
45
46
47
48
49
50
51
52
53
54
import "./App.css";
import { useEffect, useState } from "react";
import todoService from "./service/todo.service";
import "bootstrap/dist/css/bootstrap.min.css";
const App = () => {
const [todos, setTodos] = useState([]);
useEffect(() => {
todoService
.getAll()
.then((res) => {
console.log("printing todos", res.data);
setTodos(res.data);
})
.catch((err) => {
console.log("printing todos", err);
});
}, []);
//47.05
console.log("todo data", todos);
return (
<div className="container">
<h3>List of todo</h3>
<hr />
<div>
<table className="table table-striped table-bordered ">
<thead className="thead-dark">
<tr>
<th>Todo</th>
<th>Description</th>
<th>Completed</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
{todos.map((todo) => (
<tr key={todo.id}>
<td>{todo.todo} </td>
<td>{todo.description} </td>
<td> {todo.completed ? "True" : "False"}</td>
<td> {todo.createdAt}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
);
};
export default App;