Skip to content

Commit 071b28d

Browse files
authoredApr 30, 2024
Update usage-with-typescript.mdx
- Replaced unused `api` identified with `usePostsQuery` - Removed unnecessary else (after return)
1 parent e46eb99 commit 071b28d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed
 

‎docs/rtk-query/usage-with-typescript.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ When using `fetchBaseQuery`, the `error` property returned from a hook will have
593593
If an error is present, you can access error properties after narrowing the type to either `FetchBaseQueryError` or `SerializedError`.
594594

595595
```tsx no-transpile
596-
import { api } from './services/api'
596+
import { usePostsQuery } from './services/api'
597597

598598
function PostDetail() {
599599
const { data, error, isLoading } = usePostsQuery()
@@ -613,10 +613,9 @@ function PostDetail() {
613613
<div>{errMsg}</div>
614614
</div>
615615
)
616-
} else {
617-
// you can access all properties of `SerializedError` here
618-
return <div>{error.message}</div>
619-
}
616+
}
617+
// you can access all properties of `SerializedError` here
618+
return <div>{error.message}</div>
620619
}
621620

622621
if (data) {

0 commit comments

Comments
 (0)