https://github.com/navneetlal/react-offline-component
Checks net connection and renders component accordingly
https://github.com/navneetlal/react-offline-component
connection detector network offline online react react-component
Last synced: 7 days ago
JSON representation
Checks net connection and renders component accordingly
- Host: GitHub
- URL: https://github.com/navneetlal/react-offline-component
- Owner: navneetlal
- License: mit
- Created: 2020-01-22T10:00:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-27T04:51:14.000Z (over 5 years ago)
- Last Synced: 2025-05-11T23:38:19.313Z (10 days ago)
- Topics: connection, detector, network, offline, online, react, react-component
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# React offline component
Simple react component that enables you to render content based on net connectivity (i.e. Online | Offline)
### Installing
```bash
$ npm install react-offline-component --save
```### Basic usage
```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { Online, Offline } from 'react-offline-component';const MainComponent = () => {
return (
Hey! You are online
You're offline. Check your connection!
)
}ReactDOM.render(, document.getElementById('root'));
```Both `Online` as well as `Offline` are conditional components. So, you won't be seeing any online or offline component unless you are in that state.
### License
Published under the [MIT License](https://github.com/navneetlal/react-offline-component/blob/master/LICENSE).