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
  271dfb18_fa2f_d2d0_84d2_78a7d088b2e4["PreactCounter()"]
  f473bd62_e4a1_aa5b_444a_cc6c7c1b8c60["PreactCounter.tsx"]
  271dfb18_fa2f_d2d0_84d2_78a7d088b2e4 -->|defined in| f473bd62_e4a1_aa5b_444a_cc6c7c1b8c60
  style 271dfb18_fa2f_d2d0_84d2_78a7d088b2e4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/e2e/fixtures/multiple-frameworks/src/components/preact/PreactCounter.tsx lines 4–19

export function PreactCounter({ children, id }) {
	const [count, setCount] = useState(0);
	const add = () => setCount((i) => i + 1);
	const subtract = () => setCount((i) => i - 1);

	return (
		<>
			<div id={id} class="counter">
				<button class="decrement" onClick={subtract}>-</button>
				<pre>{count}</pre>
				<button class="increment" 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 packages/astro/e2e/fixtures/multiple-frameworks/src/components/preact/PreactCounter.tsx.
Where is PreactCounter() defined?
PreactCounter() is defined in packages/astro/e2e/fixtures/multiple-frameworks/src/components/preact/PreactCounter.tsx at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free