Home / Function/ Counter() — astro Function Reference

Counter() — astro Function Reference

Architecture documentation for the Counter() function in Counter.jsx from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  c3363987_fc9d_1e76_55d1_7c2b2933a8b1["Counter()"]
  27973a99_b39c_4221_dd28_3d037907b62e["Counter.jsx"]
  c3363987_fc9d_1e76_55d1_7c2b2933a8b1 -->|defined in| 27973a99_b39c_4221_dd28_3d037907b62e
  style c3363987_fc9d_1e76_55d1_7c2b2933a8b1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/preact-compat-component/src/components/Counter.jsx lines 3–18

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

	return (
		<>
			<div class="counter">
				<button onClick={subtract}>-</button>
				<pre id="counter-text">{count}</pre>
				<button onClick={add}>+</button>
			</div>
			<div class="counter-message">{children}</div>
		</>
	);
}

Subdomains

Frequently Asked Questions

What does Counter() do?
Counter() is a function in the astro codebase, defined in packages/astro/test/fixtures/preact-compat-component/src/components/Counter.jsx.
Where is Counter() defined?
Counter() is defined in packages/astro/test/fixtures/preact-compat-component/src/components/Counter.jsx at line 3.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free