Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emanueljcc/react-detect-internet-connection
Library to detect the state of the internet connection in an application with react.js in a dynamic way.
https://github.com/emanueljcc/react-detect-internet-connection
connection css3 hook hooks html internet library navigator-api network react
Last synced: 24 days ago
JSON representation
Library to detect the state of the internet connection in an application with react.js in a dynamic way.
- Host: GitHub
- URL: https://github.com/emanueljcc/react-detect-internet-connection
- Owner: emanueljcc
- Created: 2022-04-04T19:43:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-04T19:48:35.000Z (over 2 years ago)
- Last Synced: 2024-10-12T13:56:02.303Z (25 days ago)
- Topics: connection, css3, hook, hooks, html, internet, library, navigator-api, network, react
- Language: JavaScript
- Homepage: https://emanueljcc.github.io/react-detect-internet-connection/
- Size: 347 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
React detect internet connection (custom hook) 📶## Description
Library to detect the state of the internet connection in an application with react.js in a dynamic way.## Install
```bash
npm install react-detect-internet-connection
```
OR
```bash
yarn add react-detect-internet-connection
```## Usage
Add the react-detect-internet-connection to your main.js for a global import:```javascript
import React from 'react'import useNetworkStatus from 'react-detect-internet-connection'
const App = () => {
// PROPS
const {
isOnline,
updateDate,
rtt,
type,
saveData,
downlink,
downlinkMax,
effectiveType,
} = useNetworkStatus()return (
Content...
);
}
```## Documentation
```javascript
const {
isOnline,
updateDate,
rtt,
type,
saveData,
downlink,
downlinkMax,
effectiveType,
} = useNetworkStatus()
```SIMPLE 😃
## Support
[email protected].
You can also send me a direct message on twitter
@emanueljcc.## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.## License
[MIT](https://choosealicense.com/licenses/mit/) License © 2022 [Emanuel Castillo](https://github.com/emanueljcc)