Skip to content

Instantly share code, notes, and snippets.

@jamiehaywood
Created November 22, 2020 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamiehaywood/fe22c4a41987259113c05f7ecacae54f to your computer and use it in GitHub Desktop.
Save jamiehaywood/fe22c4a41987259113c05f7ecacae54f to your computer and use it in GitHub Desktop.
const useGlobalState = () => {
const context = useContext(GlobalStateContext);
if (!context) {
throw new Error("useGlobalState must be used within a GlobalStateContext");
}
return context;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment