Home / Function/ Counter() — astro Function Reference

Counter() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1b595ec4_caaf_1c0e_23db_1abd8c697125["Counter()"]
  04d569e2_93dc_43f4_a81b_4ea10a9b3c91["RCounter.jsx"]
  1b595ec4_caaf_1c0e_23db_1abd8c697125 -->|defined in| 04d569e2_93dc_43f4_a81b_4ea10a9b3c91
  style 1b595ec4_caaf_1c0e_23db_1abd8c697125 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/static-build-frameworks/src/components/RCounter.jsx lines 3–18

export default 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>
		</>
	);
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free