Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rehooks/network-status
React hook to track Network status
https://github.com/rehooks/network-status
hook network react react-hooks status
Last synced: about 2 months ago
JSON representation
React hook to track Network status
- Host: GitHub
- URL: https://github.com/rehooks/network-status
- Owner: rehooks
- License: mit
- Created: 2018-10-25T20:35:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-01T02:37:55.000Z (over 3 years ago)
- Last Synced: 2024-09-30T07:00:04.280Z (2 months ago)
- Topics: hook, network, react, react-hooks, status
- Language: JavaScript
- Size: 962 KB
- Stars: 66
- Watchers: 4
- Forks: 3
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-react-hooks - `@rehooks/network-status` - status. (Packages)
- awesome-react-hooks-cn - `@rehooks/network-status` - status. (Packages)
- awesome-react-hooks - `@rehooks/network-status` - status. (Packages)
- awesome-react-hooks - `@rehooks/network-status` - status. (Packages)
README
# `@rehooks/network-status`
> React hook for getting network-status
> **Note:** This is using the new [React Hooks API Proposal](https://reactjs.org/docs/hooks-intro.html)
> which is subject to change until React 16.7 final.
>
> You'll need to install `react`, `react-dom`, etc at `^16.7.0-alpha.0`## Install
```sh
yarn add @rehooks/network-status
```## Usage
```js
import useNetworkStatus from "@rehooks/network-status";function MyComponent() {
let connection = useNetworkStatus();
return (
downlink: {connection.downlink}
effectiveType: {connection.effectiveType}
rtt: {connection.rtt}
saveData: {connection.saveData ? "yes" : "no"}
);
}
```