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
  12fc5dd5_0122_7bad_f265_192b1d8c9082["Counter()"]
  821631a3_697e_1076_72da_37c2b0371c2b["Counter.jsx"]
  12fc5dd5_0122_7bad_f265_192b1d8c9082 -->|defined in| 821631a3_697e_1076_72da_37c2b0371c2b
  style 12fc5dd5_0122_7bad_f265_192b1d8c9082 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/slots-react/src/components/Counter.jsx lines 3–22

export default function Counter({ named, dashCase, children, count: initialCount, case: id }) {
  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 id={id} className="counter-message">
        {children || <h1>Fallback</h1>}
				{named}
				{dashCase}
      </div>
    </>
  );
}

Subdomains

Frequently Asked Questions

What does Counter() do?
Counter() is a function in the astro codebase, defined in packages/astro/test/fixtures/slots-react/src/components/Counter.jsx.
Where is Counter() defined?
Counter() is defined in packages/astro/test/fixtures/slots-react/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