Created
November 1, 2018 08:54
-
-
Save theham3d/2ca027ebd4302e98627c9cecd9b7bc3c to your computer and use it in GitHub Desktop.
useContext Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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