Home / Function/ Counter() — astro Function Reference

Counter() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a5af133c_7810_a026_bdf1_8eb12537b77e["Counter()"]
  457bc11f_d018_ff26_4102_006c5b6a1bdd["Counter.tsx"]
  a5af133c_7810_a026_bdf1_8eb12537b77e -->|defined in| 457bc11f_d018_ff26_4102_006c5b6a1bdd
  style a5af133c_7810_a026_bdf1_8eb12537b77e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/css-deduplication/src/components/Counter.tsx lines 4–25

export default function Counter({
	children,
	count: initialCount,
}: {
	children: JSX.Element;
	count: number;
}) {
	const [count, setCount] = useState(initialCount);
	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>
		</>
	);
}

Subdomains

Frequently Asked Questions

What does Counter() do?
Counter() is a function in the astro codebase, defined in packages/astro/test/fixtures/css-deduplication/src/components/Counter.tsx.
Where is Counter() defined?
Counter() is defined in packages/astro/test/fixtures/css-deduplication/src/components/Counter.tsx at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free