Astro components look different from React or Vue components. What is the main reason Astro uses this unique format?
Think about how Astro aims to improve website speed by reducing JavaScript sent to the browser.
Astro components are designed to render mostly as static HTML. This reduces JavaScript sent to the browser, making pages load faster and improving performance.
Astro components are mostly static, but sometimes you need interactivity. How does Astro add client-side JavaScript only when needed?
Astro uses special keywords to control when JavaScript runs on the client.
Astro uses client directives like client:load to load JavaScript only when needed, keeping most of the page static and fast.
Which of the following Astro component snippets correctly defines a component that renders static HTML without client-side JavaScript?
Astro components use a frontmatter section with triple dashes for variables.
Astro components use a frontmatter block (between ---) to declare variables and then use them in HTML. This syntax renders static HTML without client JavaScript.
Given this Astro component code, why does it fail to render the variable name?
---
const name = 'Astro';
---
<h1>{name}</h1>
<p>{message}</p>Check which variables are declared before usage.
The variable message is used in the HTML but not declared in the frontmatter block, causing a rendering error.
Astro components have a unique lifecycle compared to React or Vue. Which statement best describes how Astro optimizes lifecycle behavior?
Think about how Astro reduces client JavaScript by doing work on the server.
Astro runs most logic during server rendering, producing static HTML. Client-side JavaScript runs only when explicitly enabled, improving performance.
