Skip to content

Instantly share code, notes, and snippets.

@theham3d
Created November 1, 2018 08:54
Show Gist options
  • Save theham3d/2ca027ebd4302e98627c9cecd9b7bc3c to your computer and use it in GitHub Desktop.
Save theham3d/2ca027ebd4302e98627c9cecd9b7bc3c to your computer and use it in GitHub Desktop.
useContext Example
import React , { useContext } from 'react';
import { AppContext } from './App';
const MyComponent = props => {
const value = useContext(AppContext);
return <h1>{value}</h1>;
}
export default MyComponent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment