use-detect-offline
v0.1.1
Published
Custom React Hook that detects where you are online or offline in a PWA
Downloads
7
Readme
use-detect-offline
Custom React Hook that detects where you are online or offline in a PWA
A custom React Hook that will detect in a browser whether you are offline or online, and whether this has changed.
Install
npm install use-detect-offline
Usage
import React from 'react'
import useDetectOffline from 'use-detect-offline'
export default function Component () {
const {offline} = useDetectOffline()
return <p>Current status: {offline ? 'offline' : 'online'4}</p>
}
License
MIT © brianbancroft