2주차 리뷰 #23
Replies: 4 comments
-
컨텍스트를 활용한 전역상태 관리에 대해서 배웠다. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
사용자 정의 훅이 있는 팩토리 패턴?
const App = () => {
const providers = [
[Counter1Provider, {initialValue: 10}],
[Counter2Provider, {initialValue: 20}],
[Counter3Provider, {initialValue: 30}],
[Counter4Provider, {initialValue: 40}],
[Counter5Provider, {initialValue: 50}],
] as const;
return providers.reduceRight(
// 오른쪽에서부터 배열을 읽으며 누산된 값을 children으로 넣어준다.
// 즉 Parent의 부모로 Counter5Provider를 붙이고,
// 만들어진 컴포넌트의 부모로 Counter4Provider를 붙이는 식.
(children, [Component, props]) => createElement(Component, props, children),
<Parent />,
);
};
|
Beta Was this translation helpful? Give feedback.
-
요약
생각
컨텍스트에서 꼭 기억해야 하는 부분
|
Beta Was this translation helpful? Give feedback.
-
한 줄 요약, 주요 내용 정리, 인상 깊은 구절, 종합 평가 등 다양하게 작성
Beta Was this translation helpful? Give feedback.
All reactions