npm.io
1.0.2 • Published 5 years ago

@ajay_g/react-netinfo

Licence
MIT
Version
1.0.2
Deps
0
Size
14 kB
Vulns
0
Weekly
0

React-Netinfo

A simple react hook to get network connectivity status

NPM JavaScript Style Guide

Install

npm install --save @ajay_g/react-netinfo
yarn add @ajay_g/react-netinfo

Usage

import React from "react";
import { useNetworkInfo } from "@ajay_g/react-netinfo";

const App = () => {
  const isOffline = useNetworkInfo();

  if (isOffline) {
    return <div>Sorry, you are offline :(</div>;
  }

  return <div>You are online :)</div>;
};

License

MIT Ajay


This hook is created using create-react-hook.

Keywords