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

Relationship Graph

Source Code

examples/with-mdx/src/components/Counter.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 class="counter">
				<button onClick={subtract}>-</button>
				<pre>{count}</pre>
				<button onClick={add}>+</button>
			</div>
			<div class="counter-message">{children}</div>
		</>
	);
}

Domain

Subdomains

Frequently Asked Questions

What does Counter() do?
Counter() is a function in the astro codebase, defined in examples/with-mdx/src/components/Counter.jsx.
Where is Counter() defined?
Counter() is defined in examples/with-mdx/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