--- title: 'useNuxtData' description: 'Access the current cached value of data fetching composables.' links: - label: Source icon: i-simple-icons-github to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/asyncData.ts size: xs --- ::callout `useNuxtData` gives you access to the current cached value of [`useAsyncData`](/docs/api/composables/use-async-data) , `useLazyAsyncData`, [`useFetch`](/docs/api/composables/use-fetch) and [`useLazyFetch`](/docs/api/composables/use-lazy-fetch) with explicitly provided key. :: ## Usage The example below shows how you can use cached data as a placeholder while the most recent data is being fetched from the server. ```vue [pages/posts.vue] ``` ```vue [pages/posts/[id\\].vue] ``` ## Optimistic Updates We can leverage the cache to update the UI after a mutation, while the data is being invalidated in the background. ```vue [pages/todos.vue] ``` ```vue [components/NewTodo.vue] ``` ## Type ```ts useNuxtData (key: string): { data: Ref } ```