Skip to content

Commit 64207b2

Browse files
committed
keep reducer pure
1 parent 7ca8102 commit 64207b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const todoReducer = (state, action) => {
6060
case 'ADD_TODO':
6161
return state.concat({
6262
task: action.task,
63-
id: uuid(),
63+
id: action.id,
6464
complete: false,
6565
});
6666
default:
@@ -169,7 +169,7 @@ const AddTodo = () => {
169169

170170
const handleSubmit = event => {
171171
if (task) {
172-
dispatch({ type: 'ADD_TODO', task });
172+
dispatch({ type: 'ADD_TODO', task, id: uuid() });
173173
}
174174

175175
setTask('');

0 commit comments

Comments
 (0)