#root
View Compiled
const { useState } = React;
function GreatCounter() {
const [count, setCount] = useState(0);
return (
<div>
<p>Current counter value:</p>
<h2>{count}</h2>
<button onClick={() => setCount(count + 1)}>
Plus 1
</button>
<button onClick={() => {}}>
Minus 1
</button>
<p>Last button clicked:</p>
<h2>????</h2>
</div>
);
}
ReactDOM.render(<GreatCounter/>, document.getElementById("root"));
View Compiled
This Pen doesn't use any external CSS resources.