Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 19, 2021. It is now read-only.

Commit d93b148

Browse files
NigelNigel
Nigel
authored and
Nigel
committed
make todoSlice initState empty
1 parent b9adff2 commit d93b148

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

‎src/redux/todosSlice.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import uuid from 'uuid';
44
const initialState = [
55
{
66
id: uuid(),
7-
name: 'Read a bit',
8-
complete: true
9-
},
10-
{
11-
id: uuid(),
12-
name: 'Do laundry',
7+
name: '',
138
complete: false
149
}
1510
];
@@ -43,7 +38,7 @@ const todosSlice = createSlice({
4338
state.push(action.payload);
4439
},
4540
updateNameTodo(state, action: PayloadAction<IUpdateNameTodo>) {
46-
const { id, name } = action.payload
41+
const { id, name } = action.payload;
4742
const todo = state.find(todo => todo.id === id);
4843
todo && (todo.name = name);
4944
},
@@ -52,11 +47,11 @@ const todosSlice = createSlice({
5247
todo && (todo.complete = action.payload.complete);
5348
},
5449
deleteTodo(state, action: PayloadAction<IDeleteTodo>) {
55-
return state.filter((todo) => todo.id !== action.payload.id)
50+
return state.filter((todo) => todo.id !== action.payload.id);
5651
}
5752
}
5853
});
5954

60-
export const { addTodo, updateNameTodo, toggleTodo, deleteTodo } = todosSlice.actions
55+
export const { addTodo, updateNameTodo, toggleTodo, deleteTodo } = todosSlice.actions;
6156

62-
export default todosSlice.reducer
57+
export default todosSlice.reducer;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /