Skip to content

Commit

Permalink
Update part-5-async-logic.md (#4747)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasnagel authored Nov 2, 2024
1 parent 025adaa commit 2526cfc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/tutorials/essentials/part-5-async-logic.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ import { createSlice, nanoid } from '@reduxjs/toolkit'
// highlight-start
interface PostsState {
posts: Post[]
status: 'idle' | 'pending' | 'succeeded' | 'rejected'
status: 'idle' | 'pending' | 'succeeded' | 'failed'
error: string | null
}

Expand Down Expand Up @@ -1026,6 +1026,12 @@ const postsSlice = createSlice({
// highlight-end
}
})

// highlight-start
// Remove `postAdded`
export const { postUpdated, reactionAdded } = postsSlice.actions
// highlight-end

```

### Checking Thunk Results in Components
Expand All @@ -1052,10 +1058,11 @@ import { addNewPost } from './postsSlice'
// omit field types

export const AddPostForm = () => {
// highlight-next-line
// highlight-start
const [addRequestStatus, setAddRequestStatus] = useState<'idle' | 'pending'>(
'idle'
)
// highlight-end

const dispatch = useAppDispatch()
const userId = useAppSelector(selectCurrentUsername)!
Expand Down

0 comments on commit 2526cfc

Please sign in to comment.