🌟Introduction
A React custom hook to check the online status of a user's device.
This version supports TypeScript
Installation
Install the package using npm or yarn
or
Usage
Import the useOnlineStatus
hook into your React component and use it to check the online status.
How it works
The useOnlineStatus
hook utilizes the navigator.onLine
property to determine the initial online status of the user's device. It also adds event listeners for the online
and offline
events to update the online status dynamically.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Last updated