useOnline
Tracks whether the browser is currently connected to the network (navigator.onLine) using useSyncExternalStore.
Loading preview...
The useOnline hook subscribes to window online and offline events via useSyncExternalStore and returns a boolean reflecting navigator.onLine (defaulting to true during SSR).
Installation
Usage
Examples
Offline Banner Notification
Display a status banner whenever the user loses network connectivity.
Disabling Network Actions While Offline
Prevent form submission buttons from firing while the browser is disconnected.