useNetworkQuality()
The
useNetworkQuality() hook tracks the user's connection status, providing real-time updates on effective network type, downlink speed, and RTT latency.Import
typescript
Usage
Connection Status
Online
TypeUNKNOWN
Downlink0 Mbps
RTT0 ms
Component.tsx
API
Arguments
This hook does not accept any arguments.
Returns
Returns an object with the following properties:
online– boolean True if the user is connected to the internet.effectiveType– string Connection type (e.g., '4g', '3g', '2g', 'slow-2g').downlink– number Effective bandwidth estimate in Mbps.rtt– number Estimated round-trip time (ping) in milliseconds.saveData– boolean True if the user has requested reduced data usage.