Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import a React component in Astro.
Astro
import MyComponent from '[1]';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a Vue or Svelte file extension for a React component.
✗ Incorrect
Astro supports importing React components using the .jsx extension.
2fill in blank
mediumComplete the code to use a Svelte component inside an Astro page.
Astro
<SvelteComponent client:[1] /> Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using client:load which loads immediately, not lazily.
✗ Incorrect
The client:visible directive loads the component when it becomes visible in the viewport.
3fill in blank
hardFix the error in this Astro component import statement.
Astro
import Button from './Button.[1]';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using .js or .ts which may not work for React components.
✗ Incorrect
React components in Astro typically use the .jsx extension.
4fill in blank
hardFill both blanks to create a dictionary of components with their frameworks.
Astro
const components = { '[1]': 'React', '[2]': 'Svelte' }; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing component names that don't match the framework.
✗ Incorrect
Button is commonly a React component, Card can be a Svelte component here.
5fill in blank
hardFill all three blanks to complete the Astro frontmatter importing multiple frameworks.
Astro
--- import ReactComp from './ReactComp.[1]'; import VueComp from './VueComp.[2]'; import SvelteComp from './SvelteComp.[3]'; ---
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing file extensions between frameworks.
✗ Incorrect
React uses .jsx, Vue uses .vue, and Svelte uses .svelte extensions.