Docs
useIsClient
Determine whether the code is running on the client-side or server-side with useIsClient.
Loading...
Installation
pnpm dlx shadcn@latest add https://usekit.kiron.dev/k/use-is-client
Usage
import { useIsClient } from "@/hooks/use-is-client"
export function Component() {
const isClient = useIsClient()
return (
<div>
<h6>Is Client? </h6>
<p>{isClient ? "If you can see this ... you already know" : "No"}</p>
</div>
)
}
API Reference
Return Values
Name | Type | Description |
---|---|---|
isClient | boolean | true if running in a client-side environment, false otherwise. |