Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 404 Bytes

useNetwork.md

File metadata and controls

29 lines (23 loc) · 404 Bytes

useNetwork

React sensor hook that tracks connected hardware devices. Returns:

{
  "online": true,
  "since": "2018-10-27T08:59:05.562Z",
  "downlink": 10,
  "effectiveType": "4g",
  "rtt": 50
}

Usage

import {useNetwork} from 'react-use';

const Demo = () => {
  const state = useNetwork();

  return (
    <pre>
      {JSON.stringify(state, null, 2)}
    </pre>
  );
};