UNPKG

@vercube/vue-lazy-hydration

Version:

Optimize Vue 3 SSR with lazy hydration, delaying HTML hydration until it's needed for better performance

12 lines (11 loc) 644 B
import { AsyncComponentLoader, defineAsyncComponent, type Component } from 'vue'; import { IHydrationProps } from '../types/types'; /** * A composable function that returns a lazy hydrated Vue component. * * @template T - The type of the component. * @param {AsyncComponentLoader<T>} loader - The async component loader function. * @param {IHydrationProps} props - The hydration properties. * @returns {ReturnType<typeof defineAsyncComponent>} The lazy hydrated component. */ export declare function useLazyHydration<T extends Component>(loader: AsyncComponentLoader<T>, props: IHydrationProps): ReturnType<typeof defineAsyncComponent>;