0.0.4 • Published 7 years ago

react-is-online v0.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

react-is-online

npm version travis License

Higher order component to detect the network goes to offline or not.

Demo

Install

$ npm i react-is-online

Usage

import IsOnline from 'react-is-online'

const IsOnlineComponent = IsOnline(({ ...props }) => {
  return (
    <a
      href="#"
      onClick={ props.reconnect }
      className={ props.isOnline ? '...' : '...' }
    >
    </a>
  )
})

<IsOnlineComponent />

Props

propstypedescription
isOnlineBooleanBoolean value the network is online or not.
reconnectFunctionMethod trying to connect to the network.
isMonitoringBooleanMonitoring the network connection status.
isReconnectingBooleanReconnecting.

License

MIT