@vercube/nuxt-lazy-hydration
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

Vercube logo


npm package


@vercube/nuxt-lazy-hydration

Lazy Hydration of Server-Side Rendered for Nuxt 3

Installation

# or npm / yarn
$ pnpm add @vercube/nuxt-lazy-hydration

Add to modules in nuxt.config.ts:

import { defineNuxtConfig } from 'nuxt/config';

export default defineNuxtConfig({
  modules: ['@vercube/nuxt-lazy-hydration'],
});

Usage

To use NuxtLazyHydration just wrap your component with wrapper.

<template>
  <NuxtLazyHydration whenVisible>
    <p>Hydrated when component will be visible on screen<p>
  </NuxtLazyHydration>
</template>

You can also use it with composable

<template>
  <NeverHydratedComponent/>
</template>

<script lang="ts" setup>
  const NeverHydratedComponent = useLazyHydration(
    () => import('./SomeComponent.vue'),
    { ssrOnly: true },
  );

</script>

Props

You can find all possible props here

License

MIT

Package Sidebar

Install

npm i @vercube/nuxt-lazy-hydration

Weekly Downloads

31

Version

1.3.0

License

MIT

Unpacked Size

6.03 kB

Total Files

10

Last publish

Collaborators

  • oskar.lebuda