0.1.1 • Published 3 years ago

use-detect-offline v0.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

use-detect-offline

Custom React Hook that detects where you are online or offline in a PWA

NPM JavaScript Style Guide

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