Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

useIsClient

False on the server and during hydration, true on the client.

HooksEnvironment@gaudi/design-system/hooks/environment/use-is-clientView in StorybookSource

Defers browser-only output (theme toggles, local times, storage-backed values) without a hydration mismatch, and without the extra render of a mounted flag set in an effect.

Usage

import { useIsClient } from '@gaudi/design-system/hooks';
const isClient = useIsClient();return <time>{isClient ? date.toLocaleTimeString() : '—'}</time>;

Examples

Browser-only output

Storybook

API

1 return value

Accessibility

Render a same-size placeholder on the server so the layout does not jump and focus order does not change when the client value appears.

Notes

  • The ThemeSwitch uses it for its mounted state.