We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4bd38ea commit 8d9f60bCopy full SHA for 8d9f60b
react-todos/src/App.js
@@ -8,12 +8,26 @@ function App() {
8
{ rowNumber: 3, rowDescription: "Make dinner", rowAssigned: "User One" },
9
];
10
11
+ const addTodo = () => {
12
+ if (todos.length > 0) {
13
+ const newTodo = {
14
+ rowNumber: todos.length + 1,
15
+ rowDescription: "New todo",
16
+ rowAssigned: "User Three",
17
+ };
18
+ todos.push(newTodo);
19
+ return <TodoTable todos={todos}/>
20
+ }
21
22
+
23
return (
24
<div className="mt-5 container">
25
<div className="card">
26
<div className="card-header">Your Todo's</div>
27
<div className="card-body">
- <TodoTable todos = {todos} />
28
+ <button className="btn btn-primary" onClick={addTodo}>
29
+ Add New To-Do
30
+ </button>
31
</div>
32
33
0 commit comments