UNPKG

web-api-hooks

Version:

Essential set of React Hooks for convenient Web API consumption.

19 lines (18 loc) 667 B
import { NetworkInformation } from './experimental-types/NetworkInformation.bundled'; /** * Tracks information about the device's network connection. * * ⚗️ _The underlying technology is experimental. Please be aware about browser compatibility before using this in production._ * * @returns Connection data, or `undefined` when unavailable. * * @example * function Component() { * const networkInformation = useNetworkInformation(); * if (networkInformation) { * const { effectiveType, downlink, rtt, saveData } = networkInformation; * } * // ... * } */ export default function useNetworkInformation(): NetworkInformation | undefined;