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
  20f7a024_e37d_9de5_044b_f6c34de11c55["Counter()"]
  a7b63195_7841_e8c9_a5dc_63ce9c30965a["Counter.jsx"]
  20f7a024_e37d_9de5_044b_f6c34de11c55 -->|defined in| a7b63195_7841_e8c9_a5dc_63ce9c30965a
  style 20f7a024_e37d_9de5_044b_f6c34de11c55 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/e2e/fixtures/client-idle-timeout/src/components/Counter.jsx lines 3–18

export default function Counter({ children, count: initialCount = 0, id }) {
	const [count, setCount] = useState(initialCount);
	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>{count}</pre>
				<button className="increment" onClick={add}>+</button>
			</div>
			<div className="counter-message">{children}</div>
		</>
	);
}

Domain

Subdomains

Frequently Asked Questions

What does Counter() do?
Counter() is a function in the astro codebase, defined in packages/astro/e2e/fixtures/client-idle-timeout/src/components/Counter.jsx.
Where is Counter() defined?
Counter() is defined in packages/astro/e2e/fixtures/client-idle-timeout/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