@am-hooks/use-network

1.0.0 • Public • Published

useNetwork

온라인 오프라인 상태를 감지

Installation

yarn

yarn add @am-hooks/use-network

npm

npm i @am-hooks/use-network

Usage

import React from "react";
import useNetwork from "@am-hooks/use-network";

const App = () => {
  const handleNetworkChange = online => {
    console.log(online ? "We just went online" : "We are offline");
  };
  const onLine = useNetwork(handleNetworkChange);

  return <h2>{onLine ? "OnLine" : "Offline"}</h2>
}



Package Sidebar

Install

npm i @am-hooks/use-network

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

1.89 kB

Total Files

4

Last publish

Collaborators

  • wam-6577