Socket
Book a DemoInstallSign in
Socket

is-online-component

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-online-component

A simple react component that detects online and offline changes

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

is-online-component

npm Build Status

A simple react component that detects online and offline changes

Live demo here

Usage

$ npm install is-online-component
# OR
$ yarn add is-online-component
import React from 'react';
import IsOnline from 'is-online-component ';

const handleChange = (isOnline) => {
  console.log(isOnline);
};

const App = () => (
  <div>
    <IsOnline
      OnlineComponent={<h1>online</h1>}
      OfflineComponent={<h1>offline</h1>}
      onChange={handleChange}
    />
  </div>
);

export default App;

View demo here Edit is-online-component

Props

Following props are used while initialization

Prop NameTypeDescription
OnlineComponent (optional)React.Component or Stringthe component that will be renderized when browser is online
OfflineComponent (optional)React.Component or Stringthe component that will be renderized when browser is offline
onChange (optional)Functionfunction that will be called when the navigator be online or offline

Keywords

online

FAQs

Package last updated on 20 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.