Skip to content

Commit 818e9ce

Browse files
committed
docs: Isomorphic 이란 뭐고 어떨때 사용하는 네이밍일까 ? (feat. useIsomorphicEffect 는 뭘까)
1 parent 95a68b2 commit 818e9ce

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

384 KB
Loading

contents/posts/React/what-is-isomorphic.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ export const useIsomorphicEffect = typeof window !== "undefined" ? useLayoutEffe
133133
서버 렌더링(SSR)은 문자열 HTML을 만드는 과정일 뿐, 브라우저의 렌더 트리/레이아웃 단계가 존재하지 않습니다. <br/>
134134
그래서 "페인트 전에 동기 실행, DOM 조작" 이라는 전제 자체가 성립 안 됨으로, 실행할 타이밍이 없고 다음과 같은 경고가 발생합니다.
135135

136+
<center>
137+
<img src="./img/what-is-isomorphic/warn.png" width="400px"/>
138+
</center>
139+
136140
> Warning: useLayoutEffect does nothing on the server, because its effect runs after the DOM is updated... <br/>
141+
137142
> ⚠️ 님아... useLayoutEffect는 페인트 전에 DOM 읽거나 조작하려는 훅인데, 서버는 DOM이 없잖아요..
138143
139144
## 🧠 정리!

0 commit comments

Comments
 (0)