Skip to content

Commit 43742fc

Browse files
authored
Split apart 2 code snippets in docs (#1313)
* Split apart 2 code snippets in docs * Improve Next.js example section
1 parent c744699 commit 43742fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/src/content/docs/openapi-fetch/examples.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export const client = computed(authToken, (currentToken) =>
2626
baseUrl: "https://myapi.dev/v1/",
2727
}),
2828
);
29+
```
2930

31+
```ts
3032
// src/some-other-file.ts
3133
import { client } from "./lib/api";
3234

@@ -59,7 +61,9 @@ export default new Proxy(baseClient, {
5961
return newClient[key];
6062
},
6163
});
64+
```
6265

66+
```ts
6367
// src/some-other-file.ts
6468
import client from "./lib/api";
6569

@@ -80,7 +84,7 @@ openapi-fetch is simple vanilla JS that can be used in any project. But sometime
8084

8185
### Next.js
8286

83-
<a href="https://nextjs.org/" target="_blank" rel="noopener noreferrer">Next.js</a> is the most popular SSR framework for React. While [React Query](#react--react-query) is recommended for clientside fetching, this example shows how to take advantage of <a href="https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#fetching-data-on-the-server-with-fetch" target="_blank" rel="noopener noreferrer">server-side fetching</a>.
87+
<a href="https://nextjs.org/" target="_blank" rel="noopener noreferrer">Next.js</a> is the most popular SSR framework for React. While [React Query](#react--react-query) is recommended for all clientside fetching with openapi-fetch (not SWR), this example shows how to take advantage of Next.js’s <a href="https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#fetching-data-on-the-server-with-fetch" target="_blank" rel="noopener noreferrer">server-side fetching</a> with built-in caching.
8488

8589
[View a code example in GitHub](https://github.com/drwpow/openapi-typescript/tree/main/packages/openapi-fetch/examples/nextjs)
8690

0 commit comments

Comments
 (0)