Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/i-m-hossain/online-checker

An npm module
https://github.com/i-m-hossain/online-checker

customhook module npm react

Last synced: 23 days ago
JSON representation

An npm module

Awesome Lists containing this project

README

        

# online-checker

A custom react hook to track if the browser goes offline. This hook simply returns true or false of the current browsers online status. This is very useful if we want to render a view depending on browsers online status.

## How to use

- `npm install`

You can now import `online-checker` like so:

```
import useOnLineChecker from 'online-checker'
...
**Notice this is a default export**
...
Then use that inside script just like a normal React hook
...
const isOnLine = useOnLineChecker(); //returns true or false
```