Content-Length: 293086 | pFad | http://github.com/vueuse/vueuse/pull/4803/commits/aa4f1f5eb20f4b65e71067722e2670144fe8e3dd

C1 feat(useAsyncState): add isomorphic destructure by Arkeviz · Pull Request #4803 · vueuse/vueuse · GitHub
Skip to content

feat(useAsyncState): add isomorphic destructure #4803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs(useAsyncState): add array destructure example and paragraph abou…
…t this possibility
  • Loading branch information
Arkeviz committed Jun 7, 2025
commit aa4f1f5eb20f4b65e71067722e2670144fe8e3dd
11 changes: 11 additions & 0 deletions packages/core/useAsyncState/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,27 @@ category: State

Reactive async state. Will not block your setup function and will trigger changes once the promise is ready. The state is a `shallowRef` by default.

Also supports isomorphic destructuring via [makeDestructurable](https://vueuse.org/shared/makeDestructurable) utility.

## Usage

```ts
import { useAsyncState } from '@vueuse/core'
import axios from 'axios'

// Object destructure example
const { state, isReady, isLoading } = useAsyncState(
axios
.get('https://jsonplaceholder.typicode.com/todos/1')
.then(t => t.data),
{ id: null },
)

// Array destructure example (in right order)
const [state, execute, isLoading, isReady, error] = useAsyncState(
axios
.get('https://jsonplaceholder.typicode.com/todos/1')
.then(t => t.data),
{ id: null },
)
```








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/vueuse/vueuse/pull/4803/commits/aa4f1f5eb20f4b65e71067722e2670144fe8e3dd

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy