Higher order component to detect the network goes to offline or not.
$ npm i react-is-online
import IsOnline from 'react-is-online'
const IsOnlineComponent = IsOnline(({ ...props }) => {
return (
<a
href="#"
onClick={ props.reconnect }
className={ props.isOnline ? '...' : '...' }
>
</a>
)
})
<IsOnlineComponent />
props | type | description |
---|---|---|
isOnline |
Boolean | Boolean value the network is online or not. |
reconnect |
Function | Method trying to connect to the network. |
isMonitoring |
Boolean | Monitoring the network connection status. |
isReconnecting |
Boolean | Reconnecting. |
MIT