mynetworkinfo
v1.0.3
Published
useNetworkStatus is a lightweight and efficient React hook that provides real-time insights into the user's network status. It allows you to monitor:
Readme
mynetworkinfo
useNetworkStatus is a lightweight and efficient React hook that provides real-time insights into the user's network status. It allows you to monitor:
✅ Online/Offline Status – Detect whether the user is connected to the internet.
✅ Real-Time Network Speed – Measure download speed dynamically.
✅ Real-Time Latency (Ping) – Check network responsiveness.
✅ Network Type – Identify the current network connection (2G, 3G, 4G, 5G, LTE).
Installation
Install my-project with npm
npm i mynetworkinfo
Import Statement
import useNetwork from "mynetworkinfo"
Code Snippet
const { online, measuredSpeed, measuredLatency, rtt, effectiveType, speedUnit } = useNetwork();
Parameters
| Parameter | Description |
| :-------- | :------------------------- |
| online | Shows the staus whether the user is online or offline|
| effectiveType | Shows the network type - 2G/3G/4G|
| rtt | Shows the expected latency|
| measuredSpeed | Displays the realtime network speed|
| measuredSpeed | Displays the realtime network latency|
| speedUnit | Displays network speed unit - Kbps/Mbps|
Demo
Link for demo
https://connection-report.vercel.app/
