Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {useTheme,useThemeUpdate} from "../ThemeContext";
- export default function FunctionContextComponent(){
- const darkTheme = useTheme()
- const toggleTheme = useThemeUpdate()
- const themeStyles = {
- backgroundColor:darkTheme?'#333':'#CCC'
- }
- return (
- <>
- <button onClick={toggleTheme}>toggle Theme</button>
- <div style={themeStyles}>Function Theme</div>
- </>
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement