Skip to content

SWRVA Vue library for data fetching

With SWRV, components will get a stream of data updates constantly and automatically. The UI will always be fast and reactive.

SWRV logo

Installation

sh
vp add swrv

Quick example

vue
<script setup lang="ts">
import useSWRV from "swrv";

const { data, error, isLoading } = useSWRV("/api/user", fetcher);
</script>

<template>
  <p v-if="error">Failed to load.</p>
  <p v-else-if="isLoading">Loading…</p>
  <p v-else>Hello {{ data?.name }}</p>
</template>

Based on

SWRSWRfromVercel

Built to match SWR closely while staying idiomatic to Vue.

Released under the Apache-2.0 License.