@o7/query
v0.0.3
Published
<p align="center"> <img src="https://i.postimg.cc/T1Wk3khh/logo.png" width="112" alt="o7 Logo" /> </p>
Downloads
7
Readme
Basic Usage
<script>
import { createQuery } from '@o7/query';
const catImage = createQuery(
async () => {
const res = await fetch('/api/random-cat');
return await res.text();
},
{ key: 'random-cat' }
);
</script>
{#if catImage.isLoading}
Loading...
{:else if catImage.isError}
Error: {catImage.error}
{:else if catImage.isSuccess}
<img src={catImage.data} alt="Cat" />
{/if}