useOnline
is a tiny, zero-dependency, SSR hook for responding to online/offline changes.
npm install @uiw/react-use-online
You can use the Chrome Browser Debug Tool(f11) to set up offLine and onLine test hooks.
import React from "react";
import { useOnline } from '@uiw/react-use-online';
export default function App() {
const isOnline = useOnline();
return (
<div>
<h1 style={{ margin: 0 }}>useOnline</h1>
<div>{isOnline ? '✅ You are online' : '❌ You are offline'}</div>
</div>
);
}
- useColorScheme
useColorScheme()
is a tiny, zero-dependency, SSR hook for responding to devices color scheme changes.
As always, thanks to our amazing contributors!
Made with contributors.
Licensed under the MIT License.