Skip to content

Instantly share code, notes, and snippets.

@shunnNet
Created September 29, 2023 04:18
Show Gist options
  • Select an option

  • Save shunnNet/5da621065992f1882037de6248ed79bb to your computer and use it in GitHub Desktop.

Select an option

Save shunnNet/5da621065992f1882037de6248ed79bb to your computer and use it in GitHub Desktop.
useMemorized can't be destructed
import { useFetch, useMemoize } from '@vueuse/core'
const getTodo = useMemoize(() => useFetch('https://jsonplaceholder.typicode.com/todos/1').get().json())
const { data } = getTodo()
// get null
console.log(data)
setTimeout(() => {
// should has value here, but still get null
console.log(data)
}, 2000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment