Like.tsx — astro Source File
Architecture documentation for Like.tsx, a tsx file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 3c178090_18e6_e3c8_db1a_00145f9b8154["Like.tsx"] 58a2600d_f5df_9651_e0d8_9010ddeef24d["astro:actions"] 3c178090_18e6_e3c8_db1a_00145f9b8154 --> 58a2600d_f5df_9651_e0d8_9010ddeef24d d9988dd0_c044_f9d2_85cd_a31a0a2bdf80["react"] 3c178090_18e6_e3c8_db1a_00145f9b8154 --> d9988dd0_c044_f9d2_85cd_a31a0a2bdf80 199aee82_1d7c_c9e4_b390_1ce24eedb67e["react-dom"] 3c178090_18e6_e3c8_db1a_00145f9b8154 --> 199aee82_1d7c_c9e4_b390_1ce24eedb67e 3189c52a_a4b4_0d79_f730_dd7c1d087bfc["actions"] 3c178090_18e6_e3c8_db1a_00145f9b8154 --> 3189c52a_a4b4_0d79_f730_dd7c1d087bfc style 3c178090_18e6_e3c8_db1a_00145f9b8154 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { actions } from 'astro:actions';
import { useActionState } from 'react';
import { useFormStatus } from 'react-dom';
import { withState } from '@astrojs/react/actions';
export function Like({ postId, label, likes }: { postId: string; label: string; likes: number }) {
return (
<form action={actions.blog.like}>
<input type="hidden" name="postId" value={postId} />
<Button likes={likes} label={label} />
</form>
);
}
export function LikeWithActionState({ postId, label, likes: initial }: { postId: string; label: string; likes: number }) {
const [likes, action] = useActionState(
withState(actions.blog.likeWithActionState),
{ data: initial },
);
return (
<form action={action}>
<input type="hidden" name="postId" value={postId} />
<Button likes={likes.data} label={label} />
</form>
);
}
function Button({likes, label}: {likes: number; label: string}) {
const { pending } = useFormStatus();
return (
<button aria-label={label} disabled={pending} type="submit">
{likes} ❤️
</button>
)
}
Domain
Subdomains
Functions
Dependencies
- actions
- astro:actions
- react
- react-dom
Source
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 AstroActions domain, StateManagement subdomain.
What functions are defined in Like.tsx?
Like.tsx defines 3 function(s): Button, Like, LikeWithActionState.
What does Like.tsx depend on?
Like.tsx imports 4 module(s): actions, astro:actions, react, react-dom.
Where is Like.tsx in the architecture?
Like.tsx is located at packages/astro/e2e/fixtures/actions-react-19/src/components/Like.tsx (domain: AstroActions, subdomain: StateManagement, directory: packages/astro/e2e/fixtures/actions-react-19/src/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free