Skip to content

Instantly share code, notes, and snippets.

@DominicTobias
Last active Jan 29, 2020
Embed
What would you like to do?
App using useGlobalState
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>
);
}
@DominicTobias
Copy link
Author

DominicTobias commented Jan 29, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment