DEMO
`navigator.connection` Is not supported

useIsSupported

Is a feature supported in the browser or not.

Usage

import { useIsSupported } from '@react-hooks-library/core'

export function Demo() {
  const isSupported = useIsSupported(() => !!navigator?.connection)

  return isSupported ? (
    <div>`navigator.connection` Is supported</div>
  ) : (
    <div>`navigator.connection` Is not supported</div>
  )
}

Type Declarations

/**
 * Is a feature supported in the browser or not
 *
 * @param predicate - predicate to check if the feature is supported
 *
 * @see https://react-hooks-library.vercel.app/core/useIsSupported
 */
declare function useIsSupported(predicate: () => boolean): boolean

Source

Source | Demo | Docs