Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ottomated/o7-query

Repository files navigation

o7 Logo

@o7/query

Lightweight (< 1kb), SSR-ready async state management for Svelte.


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}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published