Skip to content

Missing export default for page component

Quick summary

Your component file is missing export default — the framework cannot find the default component to render for the route.

Why this happens

  • The component is defined but not exported as default: missing 'export default ComponentName' at the end

  • The component uses a named export but the framework expects a default export

  • The export statement has a typo or the exported name does not match the component

Minimal example

✗ Broken code
function HomePage() {
  return <div>Welcome Home</div>;
}
// missing: export default HomePage
✓ Fixed code
function HomePage() {
  return <div>Welcome Home</div>;
}
export default HomePage;

Adding the default export makes the component available as the page's main component for the framework to render.

How to diagnose

  • Check the end of the component file for 'export default ComponentName'

  • Verify the framework's convention — most React frameworks (Next.js, Astro) require default exports for pages

  • Look for a 404 or blank page when navigating to the route, which indicates a missing default export

How to fix

  • Add 'export default ComponentName' at the end of the file

  • Change a named export to a default export: replace 'export function Component' with 'function Component' plus 'export default Component'

  • If using a named export, update the import in the parent to use { Component } instead of Component

How to prevent

  • Always add export default at the end of page or route component files

  • Use a project template or snippet that includes the default export boilerplate

Related Resources

Related Glossary

Related Lessons

← Back to language