react-internet-connectivity
v1.0.10
Published
A React hook to check internet connectivity
Downloads
80
Maintainers
Readme
Internet Connectivity Checker
This is a simple React component that checks for internet connectivity using the react-internet-connectivity
hook.
Code
import React from 'react';
import { useInternetConnectivity } from "react-internet-connectivity";
function TestComponent() {
// Use the useInternetConnectivity hook to check if the user is online
const isOnline = useInternetConnectivity();
return (
<div>
<h1>Internet Connectivity Checker</h1>
{/* Display online/offline status based on the isOnline value */}
<p>{isOnline ? "You are online!" : "You are offline!"}</p>
</div>
);
}
export default TestComponent;
Made with ❤ by CalmRay