---
title: Client Only
description: Used to render content only on the client side.
links:
source: components/client-only
---
## Usage
```jsx
import { ClientOnly, Skeleton } from "@chakra-ui/react"
```
```jsx
```
## Examples
### Fallback
Use the `fallback` prop to render a loading state while the client-side content
is being prepared.
```jsx
}>
```
### Render Prop (Recommended)
When your component accesses browser-only APIs (like `window`, `document`, or
`localStorage`), use the render prop pattern to prevent server-side rendering
issues:
```jsx
}>
{() => (
Current URL: {window.location.href}
Screen width: {window.innerWidth}px
)}
```
This pattern ensures that components accessing browser APIs are only evaluated
on the client side, preventing hydration mismatches and server-side errors.
> It can also be used for rendering heavy components that are not needed on the
> server side.
### Direct Children (Use with Caution)
While you can pass components directly as children, be careful with components
that access browser APIs:
```tsx
/* ❌ This may cause server-side errors */
}>
/* ✅ This is safe */
}>
{() => }
```
## Props
These props can be passed to the `ClientOnly` component.