@ajay_g/react-netinfo

1.0.2 • Public • Published

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.

Package Sidebar

Install

npm i @ajay_g/react-netinfo

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

14.5 kB

Total Files

15

Last publish

Collaborators

  • ajay_g