Skip to content

Commit 1d84f5d

Browse files
committed
반복되는 로직 setState에 추가
1 parent 20050fd commit 1d84f5d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/App.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ export default function App({ $target, initialState, initialCount }) {
1515
onSubmit: (text) => {
1616
const nextState = [...todoList.state, { text, isCompleted: false }];
1717
todoList.setState(nextState);
18-
updateCount(nextState);
19-
setItem("todo", JSON.stringify(nextState));
2018
},
2119
});
2220

2321
const todoList = new TodoList({
2422
$target,
2523
initialState,
26-
updateCount: () => updateCount(todoList.state),
24+
updateCount: (state) => updateCount(state),
2725
});
2826

2927
const todoCount = new TodoCount({

0 commit comments

Comments
 (0)