Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/rehooks/online-status
- Owner: rehooks
- License: mit
- Created: 2018-10-25T19:34:45.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T17:51:54.000Z (almost 3 years ago)
- Last Synced: 2024-09-19T16:18:00.087Z (4 months ago)
- Language: JavaScript
- Size: 474 KB
- Stars: 123
- Watchers: 4
- Forks: 11
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-react-hooks - `@rehooks/online-status`
- awesome-react-hooks-cn - `@rehooks/online-status`
- awesome-list - online-status
- awesome-react-hooks - `@rehooks/online-status`
- awesome-react-hooks - `@rehooks/online-status`
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"}
);
}
```