Skip to content

Humed-Muhammad/react-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-neti

This tool was created using react hooks and typescript to handle network connectivity checks. It uses polling to check the network connectivity status of your device in real time.

It is also build using rollup and compliled to support both esm and cjs.

Github repository

Example

Hooks

import React from "react";
import { useConnection } from "react-neti";

export const App = () => {
  const { connection } = useConnection();
  return <div>{connection ? "Online" : "Offline"}</div>;
};

Components

import React from "react";
import { OnlineWrapper, OfflineWrapper } from "react-neti";
export const App = () => {
  return (
    <>
      <OnlineWrapper>
        I will appear only when there is internet connection available
      </OnlineWrapper>
      <OfflineWrapper>
        I will appear only when there is no internet connection
      </OfflineWrapper>
    </>
  );
};

About

React package to continuously detect the network status.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published