Home / Function/ PreactCounter() — astro Function Reference

PreactCounter() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  644d16ed_91a3_c0e3_231e_55b1d4f42f1c["PreactCounter()"]
  d5e6be09_c0da_f65e_8287_84d42775b478["PreactCounter.tsx"]
  644d16ed_91a3_c0e3_231e_55b1d4f42f1c -->|defined in| d5e6be09_c0da_f65e_8287_84d42775b478
  style 644d16ed_91a3_c0e3_231e_55b1d4f42f1c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

examples/framework-multiple/src/components/preact/PreactCounter.tsx lines 7–22

export function PreactCounter({ children }: { children?: ComponentChildren }) {
	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 PreactCounter() do?
PreactCounter() is a function in the astro codebase, defined in examples/framework-multiple/src/components/preact/PreactCounter.tsx.
Where is PreactCounter() defined?
PreactCounter() is defined in examples/framework-multiple/src/components/preact/PreactCounter.tsx at line 7.

Analyze Your Own Codebase

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

Try Supermodel Free