Skip to content

Commit

Permalink
Merge pull request #3766 from Azeirah/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson authored Oct 2, 2023
2 parents 52ab548 + 0faafdb commit c5067bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/rtk-query/usage/usage-without-react-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Cache subscriptions are used to tell RTK Query that it needs to fetch data for a
With React hooks, this behavior is instead handled within [`useQuery`](../api/created-api/hooks.mdx#usequery), [`useQuerySubscription`](../api/created-api/hooks.mdx#usequerysubscription), [`useLazyQuery`](../api/created-api/hooks.mdx#uselazyquery), and [`useLazyQuerySubscription`](../api/created-api/hooks.mdx#uselazyquerysubscription).

```ts title="Subscribing to cached data" no-transpile
dispatch(api.endpoints.getPosts.initiate())
// interact with the cache in the same way as you would with a useFetch...() hook
const {data, refetch, isLoading, isSuccess, /*...*/} = dispatch(api.endpoints.getPosts.initiate())
```

## Removing a subscription
Expand Down

0 comments on commit c5067bf

Please sign in to comment.