@@ -196,7 +196,7 @@ const todosReducer = createReducer([], {
196196 // Can still return an immutably-updated value if we want to
197197 return state .filter ( (todo , i ) => i !== action .payload .index )
198198 }
199- }
199+ })
200200```
201201
202202The 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)
462462}
463463*/
464464
465- const { createPost } = slice .actions
465+ const { createPost } = postsSlice .actions
466466
467467console .log (createPost ({ id: 123 , title: ' Hello World' }))
468468// {type : "createPost", payload : {id : 123, title : "Hello World"}}
@@ -483,7 +483,7 @@ const postsSlice = createSlice({
483483 }
484484})
485485
486- const { createPost } = slice .actions
486+ const { createPost } = postsSlice .actions
487487
488488console .log (createPost ({ id: 123 , title: ' Hello World' }))
489489// {type : "posts/createPost", payload : {id : 123, title : "Hello World"}}
@@ -505,7 +505,7 @@ const postsSlice = createSlice({
505505})
506506
507507// Extract the action creators object and the reducer
508- const { actions , reducer } = slice
508+ const { actions , reducer } = postsSlice
509509// Extract and export each action creator by name
510510export const { createPost , updatePost , deletePost } = actions
511511// Export the reducer, either as a default or named export
0 commit comments