Skip to content

Instantly share code, notes, and snippets.

@rishichawda
Created May 19, 2019 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rishichawda/aa53ee31f2e967a2adb4d9c401cddc16 to your computer and use it in GitHub Desktop.
Save rishichawda/aa53ee31f2e967a2adb4d9c401cddc16 to your computer and use it in GitHub Desktop.
ChildComponent.js with useContext - Managing Application State without Redux
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