Client Only
Client Only (클라이언트 전용)
ClientOnly 컴포넌트는 내용을 클라이언트 쪽에서만 렌더링해 줘요. 서버 쪽에서는 사용할 수 없는 DOM이나 브라우저 API에 접근해야 하는 컴포넌트에 유용해요.
출처: 문서
본문
동기 (Motivation)
ClientOnly 컴포넌트는 자식 요소를 클라이언트 쪽에서만 렌더링해요. 서버 쪽에서는 사용할 수 없는 DOM이나 브라우저 API에 접근해야 하는 컴포넌트에 유용해요.
예제 (Examples)
기본 (Basic)
import { ClientOnly } from '@ark-ui/react/client-only'
export const Basic = () => (
<ClientOnly>
<div>This content is only rendered on the client side.</div>
</ClientOnly>
)
폴백 포함 (With Fallback)
import { ClientOnly } from '@ark-ui/react/client-only'
export const WithFallback = () => (
<ClientOnly fallback={<div>Loading...</div>}>
<div>This content is only rendered on the client side.</div>
</ClientOnly>
)
API 레퍼런스 (API Reference)
ClientOnly
Props
fallback
Type: any
Required: false
Default Value: undefined
Description: undefined