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.
Turn the network off in the browser to see the status change. Connection details are not available in every browser.
const useNetwork = () => {
online?: boolean
downlink?: number
downlinkMax?: number
effectiveType?: string
rtt?: number
saveData?: boolean
type?: string
}