summaryrefslogtreecommitdiff
path: root/examples/framework-react/src/components/Counter.jsx
blob: 3ab6728e797e9e7f830de6d235cab975e6a6c7c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import React, { useState } from 'react';

export default function Counter({ children }) {
  const [count, setCount] = useState(0);
  const add = () => setCount((i) => i + 1);
  const subtract = () => setCount((i) => i - 1);

  return (
    <>
      <div className="counter">
        <button onClick={subtract}>-</button>
        <pre>{count}</pre>
        <button onClick={add}>+</button>
      </div>
      <div className="children">{children}</div>
    </>
  );
}
ions'>-25/+113 2023-07-11[ci] formatGravatar matthewp 1-1/+1 2023-07-11Fixes Response not being cloneable by middleware (#7623)Gravatar Matthew Phillips 5-0/+37 2023-07-11[ci] release (#7594)astro@2.8.1@astrojs/prefetch@0.3.0@astrojs/markdoc@0.4.2Gravatar Houston (Bot) 50-104/+100 2023-07-11Filter out astro from `peerDependencies` in `astro add` (#7620)Gravatar Chris Swithinbank 2-1/+7 2023-07-11[ci] formatGravatar bluwy 1-1/+1 2023-07-11Refactor simple CLI commands (#7619)Gravatar Bjorn Lu 12-115/+123 2023-07-10fix: `astro info` command fallback for package manager (#7618)Gravatar Emanuele Stoppa 2-1/+7 2023-07-10Add CLI startup speed benchmark (#7617)Gravatar Bjorn Lu 5-11/+95 2023-07-10[ci] formatGravatar bluwy 1-1/+1