useHydration
Commons
stable
Returns a shallow ref that is false during SSR and true once the component has mounted in the browser. In non-SSR mode it resolves immediately to true. Use it to guard client-only rendering branches without causing hydration mismatches.
API
Signature
Signature TypeScript complète extraite du fichier du composable.
useHydration delegates to useDisplay().ssr to detect the SSR context. Outside the browser it returns shallowRef(false) immediately, skipping the onMounted registration entirely.
API
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- isMounted
- false during SSR and on the first render pass; true once onMounted fires. Always true in a non-SSR context.
Usage
Exemples
Extraits de code prêts à coller.
Guard a client-only component
Deferred computation until hydrated