Skip to content

Instantly share code, notes, and snippets.

@surfer19
Created September 27, 2020 13:36
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 surfer19/e6601918df4010e4409a1289526a2aa6 to your computer and use it in GitHub Desktop.
Save surfer19/e6601918df4010e4409a1289526a2aa6 to your computer and use it in GitHub Desktop.
// global-context.jsx
export const GlobalContextProvider = (props) => {
const [state, dispatch] = useReducer(reducer, initialState);
return (
<GlobalContext.Provider value={[state, dispatch]}>
{props.children}
</GlobalContext.Provider>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment