@ajay_g/react-netinfo

A simple react hook to get network connectivity status

Usage no npm install needed!

<script type="module">
  import ajayGReactNetinfo from 'https://cdn.skypack.dev/@ajay_g/react-netinfo';
</script>

README

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.