Cookbook / Fetch Resource

Fetch Resource

async

resource() intrinsic — async fetch with loading/error/value states rendered through an if/elseif/else chain.

id
fetch-resource
since
0.5.0
file
fetch-resource.aihu
propresourcegroupifelseifelseinterpolation

Run it

source · static

This recipe doesn't have a hydrated island in the demo gallery yet. An in-browser, WASM-compiled playground (edit this source and re-render live) is planned as a follow-up — read the real source below.

Source

fetch-resource.aihu

Requires

concerns
state

Anti-patterns

  • Do not hand-roll loading/error state() flags around fetch inside an effect — resource() owns the loading/error/value lifecycle.

Related recipes