diff --git a/docs/content/3.docs/1.usage/1.data-fetching.md b/docs/content/3.docs/1.usage/1.data-fetching.md index c46c91a8d6..19a8c2c0fa 100644 --- a/docs/content/3.docs/1.usage/1.data-fetching.md +++ b/docs/content/3.docs/1.usage/1.data-fetching.md @@ -71,6 +71,24 @@ const { data } = await useAsyncData('count', () => $fetch('/api/count')) This composable behaves identically to `useAsyncData` with the `lazy: true` option set. In other words, the async function does not block navigation. That means you will need to handle the situation where the data is `null` (or whatever value you have provided in a custom `default` factory function). +### Example + +```vue + + + +``` + ## `useFetch` Within your pages, components and plugins you can use `useFetch` to universally fetch from any URL. @@ -121,6 +139,30 @@ const { data } = await useFetch('/api/count') This composable behaves identically to `useFetch` with the `lazy: true` option set. In other words, the async function does not block navigation. That means you will need to handle the situation where the data is `null` (or whatever value you have provided in a custom `default` factory function). +### Example + +```vue + + + +``` + ## Isomorphic fetch When we call `fetch` in the browser, user headers like `cookie` will be directly sent to the API.