Skip to Content
⭐️ Leave a star →
HooksuseOnlineStatus

useOnlineStatus

Subscribes to the online / offline window events and returns the current navigator.onLine value. SSR-safe — returns true on the server.

import { useOnlineStatus } from '@wire-ui/react' function Status() { const online = useOnlineStatus() return <div data-status={online ? 'online' : 'offline'}>{online ? 'Online' : 'Offline'}</div> }

Returns

boolean — backed by useSyncExternalStore for tear-free updates.

The online event is unreliable on its own — the browser reports navigator.onLine based on the OS network stack, not actual connectivity to your server. For real reachability checks, follow this up with a fetch against a small known endpoint.

Last updated on

MIT License © 2026 wire-ui

useOnlineStatus – Wire UI