Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Fixes issue pacocoursey#311

Used a conditional rendering strategy that waits until the client has mounted before rendering the Image component.
  • Loading branch information
kanavbajaj authored Jan 4, 2025
1 parent 1b51044 commit 8128128
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions next-themes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ To avoid [Layout Shift](https://web.dev/cls/), consider rendering a skeleton/pla
Showing different images based on the current theme also suffers from the hydration mismatch problem. With [`next/image`](https://nextjs.org/docs/basic-features/image-optimization) you can use an empty image until the theme is resolved:

```jsx
import Image from 'next/image'
[import Image from 'next/image'
import { useTheme } from 'next-themes'

function ThemedImage() {
Expand All @@ -447,7 +447,7 @@ function ThemedImage() {
return <Image src={src} width={400} height={400} />
}

export default ThemedImage
export default ThemedImage](https://github.com/kanavbajaj/next-themes.git)
```
#### CSS
Expand Down

0 comments on commit 8128128

Please sign in to comment.