/** @jsx h */
/** @jsxFrag Fragment */
import { Fragment, h, render } from "https://esm.sh/preact@10.6.4";
import { useState } from "https://esm.sh/preact@10.6.4/hooks";


const App = () => {
  const [count, setCount] = useState(0);
  const countUp = useCallback(() => setCount((prev) => prev + 1), []);
  const countDown = useCallback(() => setCount((prev) => prev - 1), []);
  
  return (
    <div style="position: fixed; top:60px; left: 50%; transform: translate(-50%, 0); background-color: var(--page-bg, #fefefe); border: solid 1px rgba(0,0,0,.15); border-radius: 4px;">
      Counter: {count}<br />
      <span style="user-select: none;" onClick={countUp}>+</span>
      <span style="user-select: none;" onClick={countDown}>-</span>
    </div>
  );
};

const div = document.createElement("div");
document.body.append(div);
render(<App />, div);
