Home / File/ Counter.tsx — astro Source File

Counter.tsx — astro Source File

Architecture documentation for Counter.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
  0b864290_5305_c122_d20e_7d3d701ccd6f["Counter.tsx"]
  a883c589_6428_b48b_6f71_6f00930ff5b9["Counter.css"]
  0b864290_5305_c122_d20e_7d3d701ccd6f --> a883c589_6428_b48b_6f71_6f00930ff5b9
  d9988dd0_c044_f9d2_85cd_a31a0a2bdf80["react"]
  0b864290_5305_c122_d20e_7d3d701ccd6f --> d9988dd0_c044_f9d2_85cd_a31a0a2bdf80
  style 0b864290_5305_c122_d20e_7d3d701ccd6f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { useState } from 'react';
import './Counter.css';

export default function Counter({
	children,
	count: initialCount,
}: {
	children: JSX.Element;
	count: number;
}) {
	const [count, setCount] = useState(initialCount);
	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>
		</>
	);
}

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does Counter.tsx do?
Counter.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 Counter.tsx?
Counter.tsx defines 1 function(s): Counter.
What does Counter.tsx depend on?
Counter.tsx imports 2 module(s): Counter.css, react.
Where is Counter.tsx in the architecture?
Counter.tsx is located at examples/framework-react/src/components/Counter.tsx (domain: CoreAstro, subdomain: RenderingEngine, directory: examples/framework-react/src/components).

Analyze Your Own Codebase

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

Try Supermodel Free