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

Relationship Graph

Source Code

packages/astro/test/fixtures/slots-preact/src/components/Counter.jsx lines 4–23

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-preact/src/components/Counter.jsx.
Where is Counter() defined?
Counter() is defined in packages/astro/test/fixtures/slots-preact/src/components/Counter.jsx at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free