Skip to content

Instantly share code, notes, and snippets.

@joboccara
Last active April 23, 2021 12:54
Show Gist options
  • Save joboccara/b30834dffc3e1c65ee77415b2018901c to your computer and use it in GitHub Desktop.
Save joboccara/b30834dffc3e1c65ee77415b2018901c to your computer and use it in GitHub Desktop.
const Child = () => {
const { count, setCount } = React.useContext(CountContext);
return (
<div>
<Button onClick={() => setCount((count) => count)}>
Call setCount from context with same value
</button>
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment