Created
September 29, 2023 04:18
-
-
Save shunnNet/5da621065992f1882037de6248ed79bb to your computer and use it in GitHub Desktop.
useMemorized can't be destructed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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