useHooks is currently down!
useHooks
Hooks

useClient

Usage

Easy to use, no configuration required.

app/page.tsx
import { useClient } from "@pyr33x/hooks";
 
export const App = () => {
  const isClient = useClient();
  return <div>{isClient ? "Client Side" : "Server Side"}</div>;
};

Hook

You can copy & paste the hook below and make it ready to use.

useClient.ts
import { useEffect, useState } from "react";
 
export const useClient = () => {
  const [isClient, setIsClient] = useState(false);
 
  useEffect(() => {
    setIsClient(true);
  }, []);
 
  return isClient;
};

On this page