What is SSR (Server-Side Rendering) in Next.js?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Next.js topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
Server-Side Rendering (SSR) generates the HTML for a page on the server for each request. The server fetches data, renders the React component to HTML, and sends it to the browser. The browser then hydrates the HTML with React for interactivity. Pages Router SSR: export getServerSideProps from a page: export async function getServerSideProps(context) { const { params, req, res, query } = context; const data = await fetchData(params.id); if (!data) return { notFound: true }; return { props: { data } }; } export default function Page({ data }) { return <div>{data.title}</div>; }. App Router SSR: by default, App Router fetches data in Server Components (which IS SSR) — just use async/await in the component. Dynamic rendering (per-request) vs static rendering (at build time) is determined by the data fetching options. Force dynamic: export const dynamic = "force-dynamic". Benefits of SSR: always fresh data (fetched per request); can use request-specific data (cookies, headers, user session); good SEO (fully rendered HTML); secure (data fetching on server). Drawbacks: slower than static — every request triggers server rendering; higher server load; Time to First Byte (TTFB) is longer than static files. Use SSR for: personalized pages (user dashboard), real-time data (stock prices), pages where fresh data is critical. Use SSG for: blogs, marketing pages, documentation.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last Next.js project, I used this when...' immediately makes your answer more credible and memorable.
Previous
What is page.tsx in Next.js App Router?
Next
What is SSG (Static Site Generation) in Next.js?