You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rtk-query/usage-with-typescript.mdx
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -467,7 +467,7 @@ export const api = createApi({
467
467
exportconst { useGetPostQuery } =api
468
468
```
469
469
470
-
```tsx title="Using skip in a component"
470
+
```tsx no-transpile title="Using skip in a component"
471
471
import { useGetPostQuery } from './api'
472
472
473
473
function MaybePost({ id }: { id?: number }) {
@@ -486,7 +486,7 @@ While you might be able to convince yourself that the query won't be called unle
486
486
487
487
RTK Query provides a `skipToken` export which can be used as an alternative to the `skip` option in order to skip queries, while remaining type-safe. When `skipToken` is passed as the query argument to `useQuery`, `useQueryState` or `useQuerySubscription`, it provides the same effect as setting `skip: true` in the query options, while also being a valid argument in scenarios where the `arg` might be undefined otherwise.
488
488
489
-
```tsx title="Using skipToken in a component"
489
+
```tsxno-transpile title="Using skipToken in a component"
Copy file name to clipboardExpand all lines: docs/rtk-query/usage/cache-behavior.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,7 +120,7 @@ Calling the `refetch` function will force refetch the associated query.
120
120
121
121
Alternatively, you can dispatch the `initiate` thunk action for an endpoint, passing the option `forceRefetch: true` to the thunk action creator for the same effect.
122
122
123
-
```tsx title="Force refetch example"
123
+
```tsxno-transpile title="Force refetch example"
124
124
import { useDispatch } from'react-redux'
125
125
import { useGetPostsQuery } from'./api'
126
126
@@ -197,7 +197,7 @@ export const api = createApi({
197
197
})
198
198
```
199
199
200
-
```tsx title="Forcing refetch on component mount"
200
+
```tsxno-transpile title="Forcing refetch on component mount"
Copy file name to clipboardExpand all lines: docs/rtk-query/usage/migrating-to-rtk-query.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,7 +169,7 @@ export type RootState = ReturnType<typeof store.getState>
169
169
170
170
In order to have the store accessible within our app, we will wrap our `App` component with a [`Provider`](https://react-redux.js.org/api/provider) component from `react-redux`.
@@ -276,7 +276,7 @@ Our implementation below provides the following behaviour in the component:
276
276
- When our component is mounted, if a request for the provided pokemon name has not already been sent for the session, send the request off
277
277
- The hook always provides the latest received `data` when available, as well as the request status booleans `isUninitialized`, `isPending`, `isFulfilled` & `isRejected` in order to determine the current UI at any given moment as a function of our state.
// onQueryStarted is useful for optimistic updates
58
62
// The 2nd parameter is the destructured `MutationLifecycleApi`
@@ -177,7 +181,7 @@ When using `fixedCacheKey`, the `originalArgs` property is not able to be shared
177
181
178
182
This is a modified version of the complete example you can see at the bottom of the page to highlight the `updatePost` mutation. In this scenario, a post is fetched with `useQuery`, and then an `EditablePostName` component is rendered that allows us to edit the name of the post.
In the following example, you'll see `Loading` on the initial query, but then as you move forward we'll use the next/previous buttons as a _fetching_ indicator while any non-cached query is performed. When you go back, the cached data will be served instantaneously.
Copy file name to clipboardExpand all lines: docs/rtk-query/usage/polling.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ description: 'RTK Query > Usage > Polling: re-fetching data on a timer'
14
14
15
15
Polling gives you the ability to have a 'real-time' effect by causing a query to run at a specified interval. To enable polling for a query, pass a `pollingInterval` to the `useQuery` hook or action creator with an interval in milliseconds:
0 commit comments