Home / Function/ Like() — astro Function Reference

Like() — astro Function Reference

Architecture documentation for the Like() function in Like.tsx from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  0dfb64f5_71be_1a18_b72d_318712d02eab["Like()"]
  5dcbc9e7_c1d3_453d_563e_1b0d05fd79ed["Like.tsx"]
  0dfb64f5_71be_1a18_b72d_318712d02eab -->|defined in| 5dcbc9e7_c1d3_453d_563e_1b0d05fd79ed
  style 0dfb64f5_71be_1a18_b72d_318712d02eab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/e2e/fixtures/actions-blog/src/components/Like.tsx lines 4–22

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

Frequently Asked Questions

What does Like() do?
Like() is a function in the astro codebase, defined in packages/astro/e2e/fixtures/actions-blog/src/components/Like.tsx.
Where is Like() defined?
Like() is defined in packages/astro/e2e/fixtures/actions-blog/src/components/Like.tsx at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free