Performance: Markdown and MDX pages
This affects page load speed and rendering performance by how content is parsed and hydrated in the browser.
--- title: Static Page --- This is static text. <!-- Use Astro components for interactivity only where needed --> import MyComponent from '../components/MyComponent.astro'; <MyComponent client:load />
import MyComponent from '../components/MyComponent.jsx'; export default function Page() { return ( <MDXContent> <MyComponent /> <p>This is static text.</p> </MDXContent> ); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Static Markdown | Minimal DOM nodes, static HTML | 0 reflows on load | Fast paint with static content | [OK] Good |
| MDX with many React components | More DOM nodes, dynamic React tree | Multiple reflows during hydration | Slower paint due to JS execution | [X] Bad |
---
import Button from '../components/Button.jsx';
---
# Welcome
Click me
---
import Alert from '../components/Alert.jsx'
---
# Notice
This is important
Pass the test and this pattern moves unknown