WarningLimited browser support. This experimental API is mostly available in Chrome and Edge. It will return supported: false in Safari and Firefox.
ImportantBandwidth metrics (downlink, rtt) are heuristics based on recent activity and should be treated as rough estimates for adaptive loading.
The useNetworkInformation hook with the Network Information API to expose live data about the device's connection quality, such as bandwidth (downlink), latency (rtt), and connection type (e.g. WiFi, celullar). It also detects the user's explicit saveData preference.
This hook is essential for implementing Adaptative Loading strategies. By monitoring network conditions, applications can automatically serve lower-resolution assets, disable autoplay media, or defer non-critical background tasks when the user is on a congested or expensive connection.
| Name | Type | Description |
|---|---|---|
| supported | boolean | Indicates if the Network Information API is available. |
| type | 'bluetooth' | 'cellular' | 'ethernet' | 'node' | 'wifi' | 'wimax' | 'other' | 'unknown' | Physical connection type. |
| effectiveType | 'slow-2g' | '2g' | '3g' | '4g' | Estimated effective connection type. |
| downlink | number | Estimated bandwidth in Mb/s. |
| downlinkMax | number | Estimated maximum bandwidth in Mb/s. |
| rtt | number | Estimated round-trip time in ms. |
| saveData | boolean | Indicates if the user has enabled a reduced data usage mode. |