Skip to content
IT glossary
FrontendUpdated December 3, 2026

Next.js

Built on React, Next.js is a web framework that maps URLs to pages and lets you generate those pages ahead of time or when someone requests them. A project can contain both the user interface and server-side request handlers.

What Next.js adds to React

React gives you a way to build an interface out of components. Next.js provides conventions for turning those components into a website: it matches URLs to pages, builds the application, and gives you control over when page content is rendered. A documentation page can be generated ahead of time, while an account page can use information from the current request.

Routing and component boundaries

With the App Router, directories under app/ correspond to URL segments. A page.tsx file makes a page available at that path, and a layout.tsx file can wrap multiple pages with shared UI such as navigation. A directory named [slug] matches a variable segment, so app/articles/[slug]/page.tsx can serve many article URLs. You may also encounter the Pages Router, which uses pages/ and has different data-fetching APIs, such as getStaticProps and getServerSideProps.

App Router pages and layouts are Server Components by default. They can read from a data source without including the data-access code in the browser bundle. When a feature needs React state, event handlers, or browser APIs, put that feature in a Client Component. The 'use client' directive marks an entry point into the client module graph; it does not mean the component's initial HTML has to be generated in the browser.

Example: a mostly server-rendered article page

// app/articles/page.tsx
import SearchBox from './SearchBox';

export default function ArticlesPage() {
  return <><h1>Articles</h1><SearchBox /></>;
}

If SearchBox uses useState to track what the reader types, put 'use client' at the top of SearchBox.tsx. The surrounding page can remain a Server Component. On the initial load, Next.js can send HTML for the search box along with the rest of the page. React then hydrates the client UI, attaching the behavior that makes typing and other interactions work.

Rendering and caching are separate decisions

“Server Component” tells you where the component's code runs, not when it runs. Its output might be prepared at build time or produced in response to a request. For a public article index that changes after deployment, you can configure revalidation so previously generated content can be refreshed. A dashboard that depends on the visitor's session needs request-specific rendering for its personalized content, which must not be shared across users through a public cache. Check the project's Next.js version and settings before assuming what is cached by default.

What to explain in an interview

Start with the requirements rather than naming a rendering strategy. For a product page, ask how fresh the description has to be, whether a price depends on the signed-in user, and which controls need JavaScript in the browser. These are distinct decisions: a buy button can be interactive without forcing the whole page into the client bundle.