Skip to content

Commit 80daf2f

Browse files
authored
Merge pull request #1123 from Shrugsy/docs/update-usage-without-hooks
📝 Update usage without react hooks page
2 parents d7afb25 + 5dfdca2 commit 80daf2f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

docs/rtk-query/usage/usage-without-react-hooks.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ hide_title: true
99

1010
# Usage Without React Hooks
1111

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).
1313

1414
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.
1515

@@ -55,7 +55,7 @@ With React hooks, this behaviour is instead handled within [`useQuery`](../api/c
5555

5656
```ts title="Accessing cached data & request status" no-transpile
5757
const result = api.endpoints.getPosts.select()(state)
58-
const { data, status, error }
58+
const { data, status, error } = result
5959
```
6060

6161
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
6767
With React hooks, this behavior is instead handled within [`useMutation`](../api/created-api/hooks.mdx#usemutation).
6868

6969
```ts title="Triggering a mutation endpoint" no-transpile
70-
dispatch(api.endpoints.addPost.initiate({ name: "foo" }))
70+
dispatch(api.endpoints.addPost.initiate({ name: 'foo' }))
7171
```
7272

7373
## Examples
@@ -91,4 +91,3 @@ Examples of usage without React hooks can be found under the following:
9191
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
9292
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
9393
></iframe>
94-

0 commit comments

Comments
 (0)