Skip to main content

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

ArgumentDescriptionTypeDefaultValue
callbacktest callback() => unknown (Required)-
syncuse useLayoutEffect to testboolean | undefinedfalse