• Stars
    star
    123
  • Rank 290,145 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 6 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React Hook for Online status

@rehooks/online-status

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

You'll need to install react, react-dom, etc at ^16.8.4

Install

yarn add @rehooks/online-status

Usage

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

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