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

/** a counter written in React */
export 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="counter-message">{children}</div>
		</>
	);
}
rc='//www.gravatar.com/avatar/f1eebd53cdc1a65e6051a163f9dfd170?s=13&d=retro' width='13' height='13' alt='Gravatar' /> Guspan Tanadi 1-2/+1 2023-11-24style: highlight markdown Tip Note section CONTRIBUTING (#9123)Gravatar Guspan Tanadi 1-5/+7 2023-11-23fix scroll restoration issue on webKit browsers (#9186)Gravatar Martin Trapp 2-1/+7 2023-11-23fix(middleware): rename internal middleware id (#9173)Gravatar Arsh 2-1/+6 2023-11-23fix: Changelog formatting for 3.6.0 View Transition events (#9176)Gravatar Martin Trapp 1-3/+3 2023-11-22[ci] formatGravatar Eva Decker 1-3/+3 2023-11-22Fix View Transitions code block formatting (#9174)Gravatar Eva Decker 1-3/+3 2023-11-22Rename entryPoint to entrypoint (#9161)Gravatar Bjorn Lu 14-26/+38 2023-11-22Fix esbuild warning for local dev (#9160)Gravatar Bjorn Lu 1-1/+1 2023-11-22[ci] release (#9165)astro@3.6.0Gravatar Houston (Bot) 34-90/+83