Complete the code to create a basic Astro component.
--- const title = "Welcome to [1]!"; --- <html> <head><title>{title}</title></head> <body> <h1>{title}</h1> </body> </html>
The code sets the title using the Astro framework name. Astro is a modern framework for building fast websites.
Complete the code to import a component in Astro.
--- import Header from '[1]'; --- <Header />
Astro components use the .astro file extension. Importing with .astro is correct.
Fix the error in the Astro component frontmatter syntax.
--- const message = 'Hello from [1]!' --- <p>{message}</p>
The string should be properly closed and the message assigned correctly. 'Astro!' with exclamation mark inside the string is correct.
Fill both blanks to create a reactive variable and display it in Astro.
--- let count = 0; function increment() { count [1] 1; } --- <button on:click={increment}>Click me</button> <p>Count: {count[2]</p>
Use '+=' to increase count by 1 and '()' to call the variable in JSX-like syntax.
Fill all three blanks to create a simple Astro page with a title, a script, and a heading.
--- const title = '[1]'; --- <html> <head><title>{title}</title></head> <body> <h1>[2]</h1> <script type='module'> console.log('[3]'); </script> </body> </html>
The title is set to 'Welcome to Astro', the heading displays the title variable, and the script logs 'Page loaded'.
