Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/quisido/use-offline

React hook for listening to online/offline events.
https://github.com/quisido/use-offline

Last synced: 17 days ago
JSON representation

React hook for listening to online/offline events.

Awesome Lists containing this project

README

        

# useOffline [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Listen%20to%20network%20connectivity%20events%20with%20a%20React%20hook.&url=https://github.com/CharlesStover/use-offline&via=CharlesStover&hashtags=react,reactjs,javascript,typescript,webdev,webdevelopment) [![version](https://img.shields.io/npm/v/use-offline.svg)](https://www.npmjs.com/package/use-offline) [![minzipped size](https://img.shields.io/bundlephobia/minzip/use-offline.svg)](https://www.npmjs.com/package/use-offline) [![downloads](https://img.shields.io/npm/dt/use-offline.svg)](https://www.npmjs.com/package/use-offline) [![build](https://api.travis-ci.com/CharlesStover/use-offline.svg)](https://travis-ci.com/CharlesStover/use-offline/)

Listen to network connectivity events with a React hook.

- [Install](#install)
- [Use](#use)
- [Sponsor](#sponsor)

## Install

- `npm install use-offline` or
- `yarn add use-offline`

## Use

```javascript
function App() {
const isOffline = useOffline();
return

You are {isOffline ? 'offline' : 'online'}.

;
}
```

## Sponsor 💗

If you are a fan of this project, you may
[become a sponsor](https://github.com/sponsors/CharlesStover)
via GitHub's Sponsors Program.