Created
December 3, 2018 15:05
-
-
Save quisido/e6d94e6a6c366f348ce733279fa59f29 to your computer and use it in GitHub Desktop.
Manage global state with React Hooks
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
const MyComponent = () => { | |
const [ global, setGlobal ] = useGlobal(); | |
if (global.x) { | |
return global.x; | |
} | |
return global.y; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment