Skip to content

tbranyen/online-status

 
 

Repository files navigation

@rehooks/online-status

React hook for subscribing to online/offline events and the navigator.onLine property to see current status

Note: This is using the new React Hooks API Proposal which is subject to change until React 16.7 final.

You'll need to install react, react-dom, etc at ^16.7.0-alpha.0

Install

yarn add @rehooks/online-status

Usage

import useOnlineStatus from '@rehooks/online-status';

function MyComponent() {
  let onlineStatus = useOnlineStatus();
  return (
    <div>
      <h1>You are {onlineStatus ? "Online" : "Offline"}</h1>
    </div>
}

About

React Hook for Online status

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 82.1%
  • HTML 17.9%