Created
April 23, 2021 07:18
-
-
Save joboccara/50e48dff78862cbb256b6c8e7ace507f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const CountContext = React.createContext(null); | |
const CountContextProvider = ({ children }) => { | |
const [count, setCount] = React.useState(0); | |
return ( | |
<CountContext.Provider value={{ count, setCount }}> | |
<GrandParent>{children}</GrandParent> | |
</CountContext.Provider> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment