mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
[React19-blog]: Make use(context) example easier to understand (#6783)
* Make use(Context) example easier to understand * Update src/content/blog/2024/04/25/react-19.md Co-authored-by: Ricky <rickhanlonii@gmail.com> * Update src/content/blog/2024/04/25/react-19.md Co-authored-by: Ricky <rickhanlonii@gmail.com> * Update src/content/blog/2024/04/25/react-19.md Co-authored-by: Ricky <rickhanlonii@gmail.com> * Update src/content/blog/2024/04/25/react-19.md Co-authored-by: Ricky <rickhanlonii@gmail.com> --------- Co-authored-by: Ricky <rickhanlonii@gmail.com>
This commit is contained in:
@@ -280,14 +280,14 @@ import LightThemeContext from './LightThemeContext'
|
||||
import DarkThemeContext from './ThemeContext'
|
||||
|
||||
function ThemedPage({theme, children}) {
|
||||
let theme;
|
||||
let currentTheme;
|
||||
if (theme === 'dark') {
|
||||
theme = use(DarkThemeContext);
|
||||
currentTheme = use(DarkThemeContext);
|
||||
} else {
|
||||
theme = use(LightThemeContext);
|
||||
currentTheme = use(LightThemeContext);
|
||||
}
|
||||
return (
|
||||
<Page theme={theme}>
|
||||
<Page theme={currentTheme}>
|
||||
{children}
|
||||
</Page>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user