Open Ashutoshdikshit07 opened 7 months ago
Hint to create a isOnline hook - `function useIsOnline(){ const [isOnline, setIsOnline] = useState(window.navigator.onLine)
useEffect(()=>{ window.addEventListener("online",()=>{ setIsOnline(true) })
window.addEventListener("offline",()=>{
setIsOnline(false)
})
},[])
return isOnline }
function App(){
const isOnline = useIsOnline()
if(isOnline){ return "you are online yay!!" } else{ return "you are offline please connect to the internet" } `
Browser functionality hooks. Create a custom hook to tell if they are online or not.