useNetwork

Read the state of the connection and know when it goes online or offline.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Turn the network off in the browser to see the status change. Connection details are not available in every browser.

APIs

useNetwork

const useNetwork = () => {
  online?: boolean
  downlink?: number
  downlinkMax?: number
  effectiveType?: string
  rtt?: number
  saveData?: boolean
  type?: string
}
Edit this page on GitHub