JS Guide
HomeQuestionsSearchResources
Search

Built for developers preparing for JavaScript, React & TypeScript interviews.

ResourcesQuestionsSupport
HomeQuestionsSearchProgress
HomeQuestionsnextjs

nextjs

Next.js app router, SSR, and full-stack patterns

Your Progress

0 of 5 completed

0%

5 Questions

mid Level
1
What are the key differences between Pages Router and App Router in Next.js?
mid
routing
Pages Router uses the `pages/` directory with getServerSideProps/getStaticProps for data fetching, while App Router uses the `app/` directory with React Server Components, nested layouts, and streaming - and is the recommended approach for new projects.
2
How does data fetching work in Next.js?
mid
data-fetching
In the App Router, data is fetched directly in Server Components using `async/await` with automatic caching. The Pages Router uses special functions like `getStaticProps` (build time) and `getServerSideProps` (request time).
3
What's the difference between Server Components and Client Components in Next.js?
mid
components
Server Components render on the server with no JavaScript sent to the client, ideal for data fetching and static content. Client Components (marked with 'use client') render on both server and client, enabling interactivity like state and event handlers.
4
How do you create dynamic routes with static generation in Next.js?
mid
routing
Dynamic routes use bracket syntax like `[id]` in folder/file names. For static generation, use `generateStaticParams` (App Router) or `getStaticPaths` (Pages Router) to define which paths should be pre-rendered at build time.
5
How do API routes work in Next.js?
mid
api
API routes let you build backend endpoints within your Next.js app. In the Pages Router, files in `pages/api/` export handlers. In the App Router, you create `route.ts` files that export functions named after HTTP methods (GET, POST, etc.).