Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/quisido/use-offline
- Owner: quisido
- License: mit
- Created: 2020-10-17T23:22:44.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-27T21:24:04.000Z (over 3 years ago)
- Last Synced: 2024-05-10T18:58:12.456Z (6 months ago)
- Language: TypeScript
- Size: 44.8 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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();
returnYou 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.