npm.io
1.0.1 • Published 6 years ago

@hoooks/use-network

Licence
MIT
Version
1.0.1
Deps
0
Size
2 kB
Vulns
0
Weekly
0
Stars
1

@hoooks/use-network

Check whether the network status is online or offline.

Installation

yarn

yarn add @hoooks/use-network

npm

npm i @hoooks/use-network

Usage

import React from "react";
import useTitle from "@hoooks/use-network";

export default function App() {
  const isOnline = useNetwork();
  return (
      <>
        <h1>{isOnline ? "Online" : "Offline"}</h1>
      </>
  );
}
Return
Return Type Description
Boolean Boolean A boolean indicating the network status

Keywords