Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/rehooks/online-status

React Hook for Online status
https://github.com/rehooks/online-status

Last synced: 3 months ago
JSON representation

React Hook for Online status

Awesome Lists containing this project

README

        

# `@rehooks/online-status`

> React hook for subscribing to `online`/`offline` events and the `navigator.onLine` property to see current status

> You'll need to install `react`, `react-dom`, etc at `^16.8.4`

## Install

```sh
yarn add @rehooks/online-status
```

## Usage

```js
import useOnlineStatus from '@rehooks/online-status';

function MyComponent() {
const onlineStatus = useOnlineStatus();
return (


You are {onlineStatus ? "Online" : "Offline"}



);
}
```