1import { useNetwork } from 'react-modern-hooks'23const Demo = () => {4 const { connection } = useNetwork()56 connection.onchange = (e) => {7 // Handle change of connection type here.8 }910 return (11 <div>12 <h1>Network Info</h1>13 <p>Downlink: {connection.downlink} </p>14 <p>Downlink Max: {connection.downlinkMax}</p>15 <p>Round trip time: {connection.rtt}</p>16 <p>17 Has user set a reduced data usage option on the user agent:{' '}18 {connection.saveData}19 </p>20 <p>Connection Type: {connection.type}</p>21 </div>22 )23}2425export default Demo
No input variables
connection - The connection response of the network