Skip to content

Latest commit

Β 

History

History
23 lines (16 loc) Β· 406 Bytes

useOnlineStatus.md

File metadata and controls

23 lines (16 loc) Β· 406 Bytes

πŸ₯’ useOnlineStatus

Subscribe to online/offline events and the navigator.onLine property to see current status

Returns

  • onlineStatus: Bool: current online status

Usage

import { useOnlineStatus } from "react-recipes";

function App() {
  const onlineStatus = useOnlineStatus();

  return (
    <div>
      <h1>You are {onlineStatus ? "Online" : "Offline"}</h1>
    </div>
  );
}