From 0faafdb58e4cf6fa385442c148390c719c3265b8 Mon Sep 17 00:00:00 2001 From: Laura Date: Mon, 2 Oct 2023 13:41:12 +0200 Subject: [PATCH] Update usage-without-react-hooks.mdx --- docs/rtk-query/usage/usage-without-react-hooks.mdx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/rtk-query/usage/usage-without-react-hooks.mdx b/docs/rtk-query/usage/usage-without-react-hooks.mdx index b2007ee943..70b642c36c 100644 --- a/docs/rtk-query/usage/usage-without-react-hooks.mdx +++ b/docs/rtk-query/usage/usage-without-react-hooks.mdx @@ -23,10 +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 -const subscription = dispatch(api.endpoints.getPosts.initiate()) -// The subscription contains the same methods as you would find in the hook -// ...subscription.refetch(); -// ...subscription.isLoading; +// 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