Skip to content

Commit a65ddaa

Browse files
committed
Start functionality to add todo
1 parent 9de815d commit a65ddaa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

react-todos/src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ function App() {
1111
const [todos, setTodos] = useState(seededTodos);
1212

1313
const addTodo = () => {
14-
if (todos.length > 0) {
14+
if (seededTodos.length > 0) {
1515
const newTodo = {
1616
rowNumber: todos.length + 1,
1717
rowDescription: "New todo",
1818
rowAssigned: "User Three",
1919
};
20-
setTodos(newTodo);
20+
setTodos(todos => [...todos, newTodo])
2121
}
2222
};
2323

0 commit comments

Comments
 (0)