Q1: What is Next.js and why use it over plain React?
Next.js is a full-stack React framework built by Vercel. While plain React is a client-side rendering (CSR) library, Next.js provides hybrid rendering (SSR, SSG, ISR), file-based routing, automatic code splitting, image/font optimizations, Server Components, and API routes out of the box.
File-based Page Definition
// app/about/page.js -> Creates /about route automatically
export default function AboutPage() {
return <h1>About Us</h1>;
}Creating page.js inside the app/about folder instantly maps it to the /about URL path.
Key Takeaways
Provides full-stack capabilities (Hybrid SSR, SSG, RSC, and API Route endpoints).
Enhances SEO, initial page load speeds, and Core Web Vitals automatically.
Knowledge Check
What primary performance drawback of traditional React Single Page Applications (SPAs) does Next.js solve?