use-supported
Hydration-stable feature detection.
| Package | @vizejs/composable/use-supported |
| Own the source | vize lib pull composable:use-supported |
| Runtime exports | useSupported |
| Gzip budget | 1024 B |
Usage
import { useSupported } from "@vizejs/composable/use-supported";
Runtime contract
| Utility | Category | Stability | SSR | Hydration | Cleanup | Targets | Host globals | Uses |
|---|---|---|---|---|---|---|---|---|
useSupported |
capability | experimental | deterministic-fallback | stable | none | web, server, worker, native, desktop, terminal | window |
useMounted |
API
useSupported
Hydration-stable feature detection. Inside a component the result is false until the component mounts and then reflects check(), so server and hydrating client render the same fallback first. Outside a component it is evaluated right away when a browser window exists and stays false otherwise. check may read reactive state; the result recomputes when it changes.
function useSupported(check: () => unknown): ComputedRef<boolean>
const isSupported = useSupported(() => "share" in navigator);