React hook for getting network-status
Note: This is using the new React Hooks API Proposal 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
yarn add @rehooks/network-statusimport useNetworkStatus from "@rehooks/network-status";
function MyComponent() {
  let connection = useNetworkStatus();
  return (
    <div>
      <div>downlink: {connection.downlink}</div>
      <div>effectiveType: {connection.effectiveType}</div>
      <div>rtt: {connection.rtt}</div>
      <div>saveData: {connection.saveData ? "yes" : "no"}</div>
    </div>
  );
}