Skip to content

Commit

Permalink
Update most of Part 8
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Jul 28, 2024
1 parent 0adf680 commit ede759c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 34 deletions.
2 changes: 2 additions & 0 deletions docs/tutorials/essentials/part-7-rtk-query-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ export const PostsList = () => {

Conceptually, `<PostsList>` is still doing all the same work it was before, but **we were able to replace the multiple `useSelector` calls and the `useEffect` dispatch with a single call to `useGetPostsQuery()`**.

(Note that at this point, the application will have some mismatches between code that is still looking at the existing `state.posts` slice for data, vs the new code that is reading from RTK Query. This is expected, and we'll fix these mismatches one at a time as we go forward.)

Previously, we were selecting a list of post IDs from the store, passing a post ID to each `<PostExcerpt>` component, and selecting each individual `Post` object from the store separately. Since the `posts` array already has all of the post objects, we've switched back to passing the post objects themselves down as props.

:::tip
Expand Down
Loading

0 comments on commit ede759c

Please sign in to comment.