Last active
January 29, 2020 15:38
-
-
Save dominictobias/ca14de2e84934818e0d404dcd5f8a3b3 to your computer and use it in GitHub Desktop.
App using useGlobalState
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
export default function App() { | |
const [theme, dispatch] = useGlobalState(appState, state => state.theme); | |
return ( | |
<div style={{ background: theme.background }}> | |
<button onClick={() => dispatch('toggleTheme')}>Toggle theme</button> | |
<p style={{ color: theme.text }}> | |
You're enjoying the {theme.name} theme | |
</p> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Part of https://medium.com/@dominictobias/using-react-hooks-for-global-redux-stores-97c092afe210 article