Q45: Can the pages/ directory and app/ directory coexist in the same Next.js project?

Yes! Next.js supports incremental migration. The pages/ directory and app/ directory can coexist in the same codebase. Routes defined in app/ take priority over identical paths in pages/.

Key Takeaways
  • Supports step-by-step incremental migration.

  • app/ directory routes take precedence over matching pages/ routes.

Knowledge Check

If both pages/about.js and app/about/page.js exist in the same codebase, which file renders when navigating to /about?