useNetworkStatus
useNetworkStatus hook provides a simple way of handling changes in the internet connection.Import
import { useNetworkStatus } from "@prismane/core/hooks";
Usage
To test this hook, you can try turning on or off your internet connection.
function Demo() { const online = useNetworkStatus(); return ( <Center as={Stack}> <Text as="h1">Your status:</Text> <Text>You network is: {online ? "online" : "offline"}</Text> </Center> ); }
API
Return Value
Name | Type | Description |
---|---|---|
isOnline | boolean | The boolean that shows if the user is online or offline. |