Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

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"}


);
}
```