Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/content/post/notes/nextjs-chrome-extension-error.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: NextJS 크둬 μ΅μŠ€ν…μ…˜ ν•˜μ΄λ“œλ ˆμ΄μ…˜ 였λ₯˜
description: Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used
date: 2025-03-04
updatedDate: 2025-03-04
tags: [nextjs, nextjs chrome extension]
category: nextjs
image: ''
---

![](/images/nextjs-chrome-extension-error/chrome-extension-error.avif)

> Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used

크둬 μ΅μŠ€ν…μ…˜ μ‚¬μš©μœΌλ‘œ μœ„μ™€ 같은 ν•˜μ΄λ“œλ ˆμ΄μ…˜ 였λ₯˜κ°€ λ°œμƒν–ˆλ‹€.
**크둬 μ΅μŠ€ν…μ…˜μ΄ DOM을 λ³€κ²½**ν•˜μ—¬ Next.jsκ°€ μ„œλ²„μ—μ„œ λ Œλ”λ§ν•œ HTMLκ³Ό ν΄λΌμ΄μ–ΈνŠΈμ—μ„œ λ Œλ”λ§ 된 HTML이 μΌμΉ˜ν•˜μ§€ μ•Šμ•„μ„œ λ°œμƒν•œ 였λ₯˜μ΄λ‹€.

```jsx highlight={3}
export default function RootLayout({ children }) {
return (
<html lang="ko" suppressHydrationWarning>
{/* ... */}
</html>
)
}
```

html νƒœκ·Έμ— `suppressHydrationWarning`λ₯Ό μΆ”κ°€ν•΄ ν•˜μ΄λ“œλ ˆμ΄μ…˜ 뢈일치λ₯Ό κ°μ§€ν–ˆμ„ λ•Œ **κ²½κ³ λ₯Ό 숨길 수 μžˆλ‹€.** html νƒœκ·Έμ—λ§Œ 속성을 μΆ”κ°€ν–ˆκΈ° λ•Œλ¬Έμ— λ‹€λ₯Έ μ»΄ν¬λ„ŒνŠΈμ—μ„œ ν•˜μ΄λ“œλ ˆμ΄μ…˜ λ¬Έμ œκ°€ λ°œμƒν•œλ‹€λ©΄ κ²½κ³ κ°€ ν‘œμ‹œλœλ‹€.

:::warning
이 방법은 λ‹¨μˆœνžˆ **κ²½κ³ λ₯Ό μˆ¨κΈ°λŠ” 것**μ΄λ―€λ‘œ 크둬 μ΅μŠ€ν…μ…˜μ΄ μ•„λ‹Œ **λ‹€λ₯Έ μ›μΈμœΌλ‘œ ν•΄λ‹Ή 였λ₯˜κ°€ λ°œμƒ**ν•œλ‹€λ©΄ **μ •ν™•ν•œ 원인을 μ°Ύμ•„ ν•΄κ²°**ν•΄μ•Ό ν•œλ‹€.
:::
3 changes: 3 additions & 0 deletions src/styles/mdx.css
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ html.dark pre.astro-code span.highlighted span {
.mdx .callout svg {
width: 16px;
height: 16px;
flex-shrink: 0;
align-self: baseline;
margin-top: 0.3em;
}
.mdx .callout[data-variant='title'] {
display: block;
Expand Down