# react-use-online-offline

> React Online Offline

Latest version **1.0.9** (published 2024-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-use-online-offline
pnpm add react-use-online-offline
yarn add react-use-online-offline
bun add react-use-online-offline
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2024-02-18 |
| First published | 2023-07-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Pintu Dey |
| Maintainers | pintudey97 |
| Keywords | react, react-use-online-offline, online offline, isOnline, check internet status, internet status, if internet, if offline, flipkart offline |

## Links

- npm: https://www.npmjs.com/package/react-use-online-offline
- npm.io page: https://npm.io/package/react-use-online-offline

## Dependencies (4)

- [@babel/cli](https://npm.io/package/@babel/cli.md) ^7.22.6
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.22.8
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.22.7
- [@babel/preset-react](https://npm.io/package/@babel/preset-react.md) ^7.22.5

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.9 (latest) — 2024-02-18
- 1.0.8 — 2024-02-18
- 1.0.6 — 2023-07-09
- 1.0.5 — 2023-07-09
- 1.0.4 — 2023-07-09
- 1.0.3 — 2023-07-09
- 1.0.2 — 2023-07-09
- 1.0.1 — 2023-07-09
- 1.0.7 — 2023-07-09

## README

# Name
React Online Offline

## Install
```javascript
npm i react-use-online-offline
```

## Code
```javascript
import { ReactOnlineOffline } from 'react-use-online-offline';
import 'react-use-online-offline/dist/style.css';

  const UseOnlineOffline=()=>{
  const { isOnline } = ReactOnlineOffline();

    return (
      <React.Fragment>
        <div className="msgbox">{isOnline===true? 'You are online':'You are offline'}</div>
      </React.Fragment>
    );
  }
```
Add `body` id in `public/index.html`
```html
<body id="body">
```

If need black and white `grayscale` when offline add this css in your project
```css
  .offline{
    filter: grayscale(100%);
    overflow:hidden;
  }
```
## Demo
See the output `https://ibb.co/wRVSy2V`

---
_Source: https://npm.io/package/react-use-online-offline · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
