Skip to content

Instantly share code, notes, and snippets.

@woodRock
Last active July 31, 2020 02:44
Show Gist options
  • Save woodRock/2a76dd2e55d8b95f089ee5d246502a2e to your computer and use it in GitHub Desktop.
Save woodRock/2a76dd2e55d8b95f089ee5d246502a2e to your computer and use it in GitHub Desktop.
React Context Template. In React, a Context is similar to a Global Variable from OO programming. We can make variables, functions, API calls, etc... accessible across multiple components.
import { useContext } from "./context";
const Example = () => {
const [thing] = useContext();
return (
<>
{thing}
</>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment