@rehooks/online-status

1.1.2 • Public • Published

@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>
  );
}

Package Sidebar

Install

npm i @rehooks/online-status

Weekly Downloads

1,178

Version

1.1.2

License

MIT

Unpacked Size

3.23 kB

Total Files

6

Last publish

Collaborators

  • fouad
  • hanford
  • iamsolankiamit
  • jmoxey
  • mathdroid
  • thejameskyle