0.0.3 • Published 12 months ago

@o7/query v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
12 months ago

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}
0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago