[TIL] Reason Why set the ContextProvider(ex.Redux StoreProvider) inside the body tag, not the outside of root layout.

Oct 16, 2024 | Oct 16, 2024
|
Ryoon.With.Wisdomtrees
Ryoon.With.Wisdomtrees
Root Layout은 기본적으로 ServerComponent로서의 역할만을 하도록 유지하는것이 좋다.
그러므로
위와 같이 설정해두는 것. 여기서 DashboardWrapper 전체 코드는 아래와 같은데,
 
 
  1. React useEffect이 구성 요소는 클라이언트 구성 요소여야 하며 'use client'맨 위에 지시문이 필요하다.
  1. use client를 명시해둔 이 컴포넌트가 ServerComponent 전체를 감싸면 안됨.
  1. 왜냐면, “When a component module contains a 'use client' directive, any usage of that component is guaranteed to be a Client Component. However, a component can still be evaluated on the client even if it does not have a 'use client' directive.” - 출처:https://react.dev/reference/rsc/use-client
 
[TIL] 2장 타입[TIL] BoilerPlate
  뒤로  
기술 로그
사이드 프로젝트
능동적 나눔과 기쁨
생각 조각 모음
독서 노트
독후감
영감 기록