@pranitdeshpande98/useonlinestatus
is a custom React hook designed to detect the online status of the user's browser. It provides a seamless way to monitor whether the user's device is connected to the internet.
You can install @pranitdeshpande98/useonlinestatus
via npm or yarn:
npm install @pranitdeshpande98/useonlinestatus
or
bash
yarn add @pranitdeshpande98/useonlinestatus
Usage
To use the @pranitdeshpande98/useonlinestatus hook in your React components, import it and invoke it with the desired timeout value (in milliseconds).
The hook returns a boolean value indicating whether the user's device is currently connected to the internet.
Parameters
timeout: The timeout value in milliseconds. After the specified time of inactivity, the user will be considered offline.
Example
You can find a simple example of how to use @pranitdeshpande98/useonlinestatus in the example directory of this repository.
License
This project is licensed under the MIT License.