-
-
Save rishichawda/aa53ee31f2e967a2adb4d9c401cddc16 to your computer and use it in GitHub Desktop.
ChildComponent.js with useContext - Managing Application State without Redux
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 from 'react' | |
import { context } from './redux'; | |
const ChildComponent = () => { | |
const state = React.useContext(context); | |
return ( | |
<div> | |
<p>This is the child component.</p> | |
<p>{state.count}</p> | |
</div> | |
); | |
} | |
export default ChildComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment