hooks/use-has-mounted
Functions
useHasMounted()
useHasMounted():
boolean
Defined in: hooks/use-has-mounted.ts:12
false on the server and on the first client render, true after mount.
Use it to defer browser-only values (a stored theme, the viewer's timezone)
so the first client render matches the server HTML and hydration stays clean.
Returns
boolean
Example
const mounted = useHasMounted()
return <span>{mounted ? theme : null}</span>