Home / Function/ Counter() — astro Function Reference

Counter() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4117aa4c_18c8_7100_a930_7e562da23386["Counter()"]
  1b1a0ea6_81b4_737e_d3b3_21f7b0326483["ReactCounter.jsx"]
  4117aa4c_18c8_7100_a930_7e562da23386 -->|defined in| 1b1a0ea6_81b4_737e_d3b3_21f7b0326483
  style 4117aa4c_18c8_7100_a930_7e562da23386 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/e2e/fixtures/nested-in-preact/src/components/react/ReactCounter.jsx lines 4–17

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

	return (
		<div id={id} className="counter">
			<button className="decrement" onClick={subtract}>-</button>
			<pre id={`${id}-count`}>{count}</pre>
			<button id={`${id}-increment`} className="increment" onClick={add}>+</button>
			<div className="children">{children}</div>
		</div>
	);
}

Domain

Subdomains

Frequently Asked Questions

What does Counter() do?
Counter() is a function in the astro codebase, defined in packages/astro/e2e/fixtures/nested-in-preact/src/components/react/ReactCounter.jsx.
Where is Counter() defined?
Counter() is defined in packages/astro/e2e/fixtures/nested-in-preact/src/components/react/ReactCounter.jsx at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free