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/usage-without-react-hooks.mdx
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ hide_title: true
9
9
10
10
# Usage Without React Hooks
11
11
12
-
Like the Redux core and Redux Toolkit, RTK Query's primary functionality is UI-agnostic and can be used with any UI layer. RTK Query also includes a version of [`createApi`](../api/createApi.mdx) designed specifically for use with React, which [automatically generates React hooks](../api/created-api/hooks.mdx).
12
+
Like the Redux core and Redux Toolkit, RTK Query's primary functionality is UI-agnostic and can be used with any UI layer. RTK Query also includes a version of [`createApi`](../api/createApi.mdx) designed specifically for use with React, which [automatically generates React hooks](../api/created-api/hooks.mdx).
13
13
14
14
While React hooks are the primary way that the majority of users are expected to be using RTK Query, the library itself uses plain JS logic and can be used both with React Class components, and independent of React itself.
15
15
@@ -55,7 +55,7 @@ With React hooks, this behaviour is instead handled within [`useQuery`](../api/c
55
55
56
56
```ts title="Accessing cached data & request status" no-transpile
57
57
const result =api.endpoints.getPosts.select()(state)
58
-
const { data, status, error }
58
+
const { data, status, error }=result
59
59
```
60
60
61
61
Note that unlike the auto-generated query hooks, derived booleans such as `isLoading`, `isFetching`, `isSuccess` are not available here. The raw `status` enum is provided instead.
@@ -67,7 +67,7 @@ Note that unlike the auto-generated query hooks, derived booleans such as `isLoa
67
67
With React hooks, this behavior is instead handled within [`useMutation`](../api/created-api/hooks.mdx#usemutation).
68
68
69
69
```ts title="Triggering a mutation endpoint" no-transpile
0 commit comments