DEMO
Offline
Toggle your network to observe changes

useOnline

Reactive online status.

Usage

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

export function Demo() {
  const isOnline = useOnline()

  return (
    <div>
      {isOnline ? <div>Online</div> : <div>Offline</div>}
      <small>Toggle your network to observe changes</small>
    </div>
  )
}

Type Declarations

/**
 * Reactive online status
 *
 * @see https://react-hooks-library.vercel.app/core/useOnline
 */
declare function useOnline(): boolean

Source

Source | Demo | Docs