Wondering what’s next for npm?Check out our public roadmap! »

    use-network-status
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.1 • Public • Published

    📡 React Hook to get the online status of the browser

    React hook useNetworkStatus() returns whether the client's browser online with updates when the network state is changed.

    Usage

    Pull the hook into your component (usually the root one) and call the hook inside the functional component.

    import { useNetworkStatus } from "use-network-status";
     
    function App() {
      const isOnline = useNetworkStatus();
     
      return (
        <div className="status">
          {isOnline ? '📡 Online' : '📴 Offline'}
        </div>
      );
    }

    Keywords

    none

    Install

    npm i use-network-status

    DownloadsWeekly Downloads

    6

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    10.9 kB

    Total Files

    15

    Last publish

    Collaborators

    • avatar