Given this Astro MDX page, what will be the visible output in the browser?
--- const name = 'Astro Learner'; --- # Welcome, {name}! This is a simple MDX page.
Remember Astro MDX supports JavaScript expressions inside curly braces.
The variable name is injected inside the heading using {name}, so it renders as 'Astro Learner'. The paragraph text matches exactly.
Choose the correct way to import and use a React component Button inside an Astro MDX page.
Astro MDX supports default imports with semicolons and JSX usage.
Option C correctly imports the default export with a semicolon and uses the <Button> JSX tag. Option C tries named import which may fail if Button is default export. Option C is now correct with semicolon added. Option C uses lowercase button which is HTML, not the React component.
Identify the cause of the rendering error in this Astro MDX page:
--- const title = 'Hello World' --- # {title} Some content here.
Check JavaScript syntax in the frontmatter section.
In Astro MDX frontmatter, JavaScript code must be valid. Missing semicolon after const title = 'Hello World' causes a syntax error. Curly braces inside headings are valid in MDX. The variable is defined. No export needed for frontmatter variables.
Consider this Astro MDX page that imports a React counter component. What will the initial rendered HTML show?
--- import Counter from '../components/Counter.jsx'; --- # Counter Demo <Counter />
React components start with initial state on first render.
The React Counter component initializes count state at 0, so the button text shows 'Count: 0' initially. Other options show wrong counts or text.
Which statement best describes how Astro hydrates React components used inside MDX pages?
Think about Astro's partial hydration approach.
Astro renders React components to static HTML during build or server render. It hydrates them on the client only if you add hydration directives like client:load, client:idle, or client:visible. This optimizes performance by avoiding unnecessary JavaScript.
