Home / File/ PreactCounter.tsx — astro Source File

PreactCounter.tsx — astro Source File

Architecture documentation for PreactCounter.tsx, a tsx file in the astro codebase. 2 imports, 0 dependents.

File tsx CoreAstro RenderingEngine 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  d5e6be09_c0da_f65e_8287_84d42775b478["PreactCounter.tsx"]
  0fef379e_25c0_6f95_11fd_6d0f7db42b7e["preact"]
  d5e6be09_c0da_f65e_8287_84d42775b478 --> 0fef379e_25c0_6f95_11fd_6d0f7db42b7e
  c842527d_3bf8_8183_b0c5_b57319266e7f["hooks"]
  d5e6be09_c0da_f65e_8287_84d42775b478 --> c842527d_3bf8_8183_b0c5_b57319266e7f
  style d5e6be09_c0da_f65e_8287_84d42775b478 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/** @jsxImportSource preact */

import type { ComponentChildren } from 'preact';
import { useState } from 'preact/hooks';

/** A counter written with Preact */
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

Functions

Dependencies

  • hooks
  • preact

Frequently Asked Questions

What does PreactCounter.tsx do?
PreactCounter.tsx is a source file in the astro codebase, written in tsx. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in PreactCounter.tsx?
PreactCounter.tsx defines 1 function(s): PreactCounter.
What does PreactCounter.tsx depend on?
PreactCounter.tsx imports 2 module(s): hooks, preact.
Where is PreactCounter.tsx in the architecture?
PreactCounter.tsx is located at examples/framework-multiple/src/components/preact/PreactCounter.tsx (domain: CoreAstro, subdomain: RenderingEngine, directory: examples/framework-multiple/src/components/preact).

Analyze Your Own Codebase

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

Try Supermodel Free