useOnline

About

Online status hook for React.

Examples

import "./styles.css";
import { useOnline } from "rooks";

function App() {
  const online = useOnline();
  console.log("I'm online");

  return (
    <div>
      <h1>Rooks: useOnline example</h1>

      <hr></hr>
      <div style={{ backgroundColor: "lightblue" }}>
        Status:You are {online ? "Online" : "Offline"}
      </div>
    </div>
  );
}

export default App;

Return value

Offline status (boolean) is returned.

Join the community!

Join our discord server! You can click the floating discord icon at the bottom right of the screen and chat with us!

Powered by vercel