Home / File/ Like.tsx — astro Source File

Like.tsx — astro Source File

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

File tsx E2ETesting TestFixtures 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  5dcbc9e7_c1d3_453d_563e_1b0d05fd79ed["Like.tsx"]
  58a2600d_f5df_9651_e0d8_9010ddeef24d["astro:actions"]
  5dcbc9e7_c1d3_453d_563e_1b0d05fd79ed --> 58a2600d_f5df_9651_e0d8_9010ddeef24d
  d9988dd0_c044_f9d2_85cd_a31a0a2bdf80["react"]
  5dcbc9e7_c1d3_453d_563e_1b0d05fd79ed --> d9988dd0_c044_f9d2_85cd_a31a0a2bdf80
  style 5dcbc9e7_c1d3_453d_563e_1b0d05fd79ed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { actions } from 'astro:actions';
import { useState } from 'react';

export function Like({ postId, initial }: { postId: string; initial: number }) {
	const [likes, setLikes] = useState(initial);
	const [pending, setPending] = useState(false);

	return (
		<button
			aria-label="Like"
			disabled={pending}
			onClick={async () => {
				setPending(true);
				setLikes(await actions.blog.like.orThrow({ postId }));
				setPending(false);
			}}
			type="submit"
		>
			{likes} ❤️
		</button>
	);
}

Domain

Subdomains

Functions

Dependencies

  • astro:actions
  • react

Frequently Asked Questions

What does Like.tsx do?
Like.tsx is a source file in the astro codebase, written in tsx. It belongs to the E2ETesting domain, TestFixtures subdomain.
What functions are defined in Like.tsx?
Like.tsx defines 1 function(s): Like.
What does Like.tsx depend on?
Like.tsx imports 2 module(s): astro:actions, react.
Where is Like.tsx in the architecture?
Like.tsx is located at packages/astro/e2e/fixtures/actions-blog/src/components/Like.tsx (domain: E2ETesting, subdomain: TestFixtures, directory: packages/astro/e2e/fixtures/actions-blog/src/components).

Analyze Your Own Codebase

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

Try Supermodel Free