@@ -196,7 +196,7 @@ const todosReducer = createReducer([], {
196
196
// Can still return an immutably-updated value if we want to
197
197
return state .filter ( (todo , i ) => i !== action .payload .index )
198
198
}
199
- }
199
+ })
200
200
```
201
201
202
202
The ability to "mutate" the state is especially helpful when trying to update deeply nested state. This complex and painful code:
@@ -462,7 +462,7 @@ console.log(postsSlice)
462
462
}
463
463
*/
464
464
465
- const { createPost } = slice .actions
465
+ const { createPost } = postsSlice .actions
466
466
467
467
console .log (createPost ({ id: 123 , title: ' Hello World' }))
468
468
// {type : "createPost", payload : {id : 123, title : "Hello World"}}
@@ -483,7 +483,7 @@ const postsSlice = createSlice({
483
483
}
484
484
})
485
485
486
- const { createPost } = slice .actions
486
+ const { createPost } = postsSlice .actions
487
487
488
488
console .log (createPost ({ id: 123 , title: ' Hello World' }))
489
489
// {type : "posts/createPost", payload : {id : 123, title : "Hello World"}}
@@ -505,7 +505,7 @@ const postsSlice = createSlice({
505
505
})
506
506
507
507
// Extract the action creators object and the reducer
508
- const { actions , reducer } = slice
508
+ const { actions , reducer } = postsSlice
509
509
// Extract and export each action creator by name
510
510
export const { createPost , updatePost , deletePost } = actions
511
511
// Export the reducer, either as a default or named export
0 commit comments