Last active
August 28, 2020 11:12
-
-
Save Uzwername/2b3b1c181f809cc79432568e0a1eed21 to your computer and use it in GitHub Desktop.
Functions vs. Components - App.js
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
const App = () => { | |
const [total, setTotal] = useState(0); | |
const incrementTotal = () => setTotal(currentTotal => currentTotal + 1); | |
return ( | |
<div className="App"> | |
<div> | |
<h4>Total Clicks: {total}</h4> | |
</div> | |
<div className="CountersContainer"> | |
<Counter onClick={incrementTotal} /> | |
<Counter onClick={incrementTotal} /> | |
<Counter onClick={incrementTotal} /> | |
</div> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment