Skip to content

Instantly share code, notes, and snippets.

@robzlabz
Created January 7, 2021 05:36
Show Gist options
  • Save robzlabz/d337f1b796c857bcb950b8f9f85c88c1 to your computer and use it in GitHub Desktop.
Save robzlabz/d337f1b796c857bcb950b8f9f85c88c1 to your computer and use it in GitHub Desktop.
Handling State di Functional Component
const CounterComponent = () => {
const [count, setCount] = React.useState(0);
return (
<div>
<p>Sudah di click: {count} kali</p>
<button onClick={() => setCount(count + 1)}>Click Saya</button>
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment