[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:
Fran Zekan
2024-04-25 23:12:08 +02:00
committed by GitHub
parent 317dcf371a
commit 9afcbf6a0c

View File

@@ -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>
);