Hint: Use self-closing tags for components in Astro [OK]
Common Mistakes:
Omitting closing tags incorrectly
Thinking only one framework's components can be used
Using incorrect HTML-like syntax
3. Given this Astro component code snippet, what will be rendered?
<ReactButton />
<VueAlert />
<SvelteCard />
Assuming each component renders a button, an alert box, and a card respectively.
medium
A. Only the ReactButton will render
B. Nothing will render because Astro does not support components
C. Syntax error because multiple frameworks are mixed
D. A button, an alert box, and a card all shown on the page
Solution
Step 1: Understand Astro's multi-framework support
Astro allows React, Vue, and Svelte components to be used together seamlessly.
Step 2: Predict rendering output
Each component renders its UI part, so all three will appear on the page.
Final Answer:
A button, an alert box, and a card all shown on the page -> Option D
Quick Check:
Multiple frameworks render together = All components visible [OK]
Hint: Astro renders all framework components together [OK]
Common Mistakes:
Assuming only one framework renders
Thinking mixing frameworks causes errors
Believing Astro does not render components
4. You wrote this Astro code but get an error:
<ReactButton></ReactButton>
<VueAlert>
What is the likely cause?
medium
A. Astro does not support self-closing tags
B. React and Vue components cannot be used together
C. Missing closing tag for <VueAlert>
D. Component names must be lowercase
Solution
Step 1: Check component tag syntax
The <VueAlert> tag is opened but not closed, causing a syntax error.
Step 2: Verify Astro's multi-framework support
Astro supports React and Vue together, so mixing is not the problem.
Final Answer:
Missing closing tag for <VueAlert> -> Option C
Quick Check:
Unclosed tag error = Missing closing tag for <VueAlert> [OK]
Hint: Always close component tags properly [OK]
Common Mistakes:
Thinking frameworks can't mix
Ignoring missing closing tags
Using lowercase component names incorrectly
5. You want to build a fast website using Astro with React for UI, Vue for forms, and Svelte for animations. How does Astro help you achieve this efficiently?
hard
A. By allowing you to combine all three frameworks in one project with optimized loading
B. By forcing you to rewrite all components in a single framework
C. By loading all frameworks fully on every page, slowing performance