Skip to content

useIsOnline

Hook to detect network connection status.

Demo

INFO

The component display the network connection informations. Try to change connection type from console to see changes.

Loading demo…
Show source code
tsx
import { useIsOnline } from "../../../.."

export const UseIsOnline = () => {
	const connectionState = useIsOnline();

	return (<div style={{ textAlign: "center" }}>
		<p>Online: {JSON.stringify(connectionState)}</p>
	</div>)
}

Released under the MIT License.