Content
useOnlineStatus
A hook that returns the current online/offline status of the client.
useOnlineStatus
Usage
API
useOnlineStatus
Returns the current online/offline status of the client.
Parameters
Name | Type | Description |
---|---|---|
callback? | (isOnline: boolean) => void | Optional callback to run on status change. The callback function receives a boolean value indicating the current online/offline status of the client. If the callback is not provided, the function will not run on status change. This is useful for triggering actions based on the online status, such as displaying a loading indicator or disabling certain features. |
Returns
Name | Type | Description |
---|---|---|
isOnline | boolean | true if online, false if offline. This value is updated whenever the online status changes. |