Skip to content

Instantly share code, notes, and snippets.

@KattyaCuevas
Created April 17, 2021 20:12
Show Gist options
  • Save KattyaCuevas/865701a0996071c431b8c121f9acf971 to your computer and use it in GitHub Desktop.
Save KattyaCuevas/865701a0996071c431b8c121f9acf971 to your computer and use it in GitHub Desktop.
const MyContext = React.useContext({});
function App() {
const [state, setState] = React.useState(false);
return (
<MyContext.Provider value={{ state, setState }}>
<MyCustomComponent />
</MyContext.Provider>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment