Stop Rebuilding UI

Shadcn.io is not affiliated with official shadcn/ui

React useIsClient Hook

React useIsClient hook to detect client-side rendering. Returns false on server, true after hydration. SSR/Next.js safe.

Know when you're on the client in React. useIsClient returns false during SSR and true after hydration completes. Use it to safely access browser APIs like window, document, localStorage, or navigator. Prevents hydration mismatch errors in Next.js. Simple boolean return—no complex state. Perfect for conditionally rendering browser-only components, accessing Web APIs, or showing loading states during SSR. Works with Next.js App Router, Pages Router, and any SSR framework. Zero dependencies, zero config.

React useIsClient Hook preview

Scroll to load preview

Installation

FAQ

Was this page helpful?

Sign in to leave feedback.