Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/tutorials/essentials/part-7-rtk-query-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,17 +479,19 @@ export const SinglePostPage = () => {
const currentUsername = useAppSelector(selectCurrentUsername)
// highlight-next-line
const { data: post, isFetching, isSuccess } = useGetPostQuery(postId!)


// highlight-next-line
let content: React.ReactNode

// highlight-next-line
const canEdit = currentUsername === post?.user

// highlight-start
if (isFetching) {
content = <Spinner text="Loading..." />
} else if (isSuccess) {
// highlight-end
content = (
// highlight-end
<article className="post">
<h2>{post.title}</h2>
<div>
Expand All @@ -506,7 +508,8 @@ export const SinglePostPage = () => {
</article>
)
}


// highlight-next-line
return <section>{content}</section>
}
```
Expand Down