<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

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://unpkg.com/react@17/umd/react.development.js
  2. https://unpkg.com/react-dom@17/umd/react-dom.development.js