Skip to content

Instantly share code, notes, and snippets.

@jaeyoung-kwon
Created November 20, 2025 04:26
Show Gist options
  • Select an option

  • Save jaeyoung-kwon/b18bb2e0325771c2af45b3e4d59ae734 to your computer and use it in GitHub Desktop.

Select an option

Save jaeyoung-kwon/b18bb2e0325771c2af45b3e4d59ae734 to your computer and use it in GitHub Desktop.
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