Skip to content

Commit c6d4b89

Browse files
committed
fix docs typos
1 parent 9c51678 commit c6d4b89

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

packages/openapi-react-query/README.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It works by using [openapi-fetch](../openapi-fetch) and [openapi-typescript](../
88
- ✅ All parameters, request bodies, and responses are type-checked and 100% match your schema
99
- ✅ No manual typing of your API
1010
- ✅ Eliminates `any` types that hide bugs
11-
-Also eliminates `as` type overrides that can also hide bugs
11+
-Eliminates `as` type overrides that can also hide bugs
1212

1313
## Setup
1414

@@ -25,42 +25,42 @@ Next, generate TypeScript types from your OpenAPI schema using openapi-typescrip
2525
npx openapi-typescript ./path/to/api/v1.yaml -o ./src/lib/api/v1.d.ts
2626
```
2727

28-
> ⚠️ Be sure to <a href="https://redocly.com/docs/cli/commands/lint/" target="_blank" rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will err on invalid schemas.
28+
> ⚠️ Be sure to <a href="https://redocly.com/docs/cli/commands/lint/" target="_blank" rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will error on invalid schemas.
2929
3030
## Usage
3131

32-
Once your types has been generated from your schema, you can create a [fetch client](../openapi-fetch), a react-query client and start querying your API.
32+
Once your types have been generated from your schema, you can create a [fetch client](../openapi-fetch), a react-query client and start querying your API.
3333

3434
```tsx
35-
import createFetchClient from "openapi-fetch";
36-
import createClient from "openapi-react-query";
37-
import type { paths } from "./my-openapi-3-schema"; // generated by openapi-typescript
35+
import createFetchClient from 'openapi-fetch';
36+
import createClient from 'openapi-react-query';
37+
import type { paths } from './my-openapi-3-schema'; // generated by openapi-typescript
3838

3939
const fetchClient = createFetchClient<paths>({
40-
baseUrl: "https://myapi.dev/v1/",
40+
baseUrl: 'https://myapi.dev/v1/',
4141
});
4242
const $api = createClient(fetchClient);
4343

4444
const MyComponent = () => {
45-
const { data, error, isLoading } = $api.useQuery(
46-
"get",
47-
"/blogposts/{post_id}",
45+
const { data, error, isPending } = $api.useQuery(
46+
'get',
47+
'/blogposts/{post_id}',
4848
{
4949
params: {
5050
path: { post_id: 5 },
5151
},
52-
},
52+
}
5353
);
5454

55-
if (isLoading || !data) return "Loading...";
55+
if (isPending || !data) return 'Loading...';
5656

57-
if (error) return `An error occured: ${error.message}`;
57+
if (error) return `An error occurred: ${error.message}`;
5858

5959
return <div>{data.title}</div>;
6060
};
6161
```
6262

63-
> You can find more information about `createFetchClient` on the [openapi-fetch documentation](../openapi-fetch).
63+
> You can find more information about `createFetchClient` in the [openapi-fetch documentation](../openapi-fetch).
6464
6565
## 📓 Docs
6666

0 commit comments

Comments
 (0)