packages
useNetworkStatus

useNetworkStatus

Returns network status

const status = useNetworkStatus();

Usage

const Component = () => {
  const networkStatus = useNetworkStatus();
 
  return (
    <>
      <p>Try disabling/enabling your network connection.</p>
      <p>{networkStatus ? 'Online ✅' : 'Offline 🚫'}</p>
    </>
  );
};

Arguments

Nothin 🤪

Returns

boolean