useOnline
Detect the current online status of the browser.
The useOnline
hook is helpful when you want to detect the current network online status of the browser.
The property returns a boolean value, with true
meaning online and false
meaning offline.
useOnline
Status is : 🟢
Try changing the network status from browser devtools settings or disconnect from internetUsage
Import the hook from @abhushanaj/react-hooks
and use in required component;
API Reference
Parameters
Parameter | Type | Description | Default |
---|---|---|---|
defaultStatus | boolean (optional) | The default status to use on server snapshots while SSR. | true |
Return Value
Parameter | Type | Description | Default |
---|---|---|---|
isOnline | boolean | The current online status of the network. | true |