useSupported
Check to see if your browser supports some feature
Usage
Live Editor
function Demo() { const isSupported = useSupported(() => "EyeDropper" in window); return ( <div> <p> window.EyeDropper is {isSupported ? "supported" : "unsupported"} in your browser </p> </div> ); };
Result
Loading...
API
useSupported
Returns
boolean
: whether the browser support
Arguments
Argument | Description | Type | DefaultValue |
---|---|---|---|
callback | test callback | () => unknown (Required) | - |
sync | use useLayoutEffect to test | boolean | undefined | false |