@tremendous/help
    Preparing search index...

    Function useOnline

    • Custom hook that tracks whether the browser is online.

      Backed by navigator.onLine and the window online/offline events. The browser can report true while the network is effectively unusable (captive portals, flaky DNS), so treat true as a hint. false is trustworthy: the browser is certain it has no network connection.

      Transitions are reported only after the value has been stable for 500ms. Browsers (Safari especially) fire online/offline in rapid alternating bursts during network transitions; reacting to every event storms the tree with synchronous re-renders and can trip React's nested-update limit. Blips shorter than the settle window are never reported. The value read on mount is not delayed.

      Returns boolean

      • Whether the browser reports being online.
      const isOnline = useOnline();

      if (!isOnline) {
      return <Paragraph>You're offline</Paragraph>;
      }