<div id="app"></app>
const { useState } = React;
const Counter = () => {
const [count, setCount] = useState(0);
return (
<>
<p>Count is {count}</p>
<button onClick={() => setCount((c) => c + 1)}>
+ 1
</button>
<span> </span>
<button onClick={() => setCount((c) => c - 1)}>
- 1
</button>
</>
);
};
ReactDOM.render(<Counter />, document.getElementById('app'));
View Compiled
This Pen doesn't use any external CSS resources.