Created
November 20, 2025 04:26
-
-
Save jaeyoung-kwon/b18bb2e0325771c2af45b3e4d59ae734 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { use } from 'react'; | |
| export default function ThemeProvider(props) { | |
| if (!props.children) { | |
| return null; | |
| } | |
| // 조건부 반환 이후의 코드도 자동으로 메모이제이션 | |
| const theme = mergeTheme(props.theme, use(ThemeContext)); | |
| return ( | |
| <ThemeContext value={theme}> | |
| {props.children} | |
| </ThemeContext> | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment