Q111. What is the difference between getStaticProps and getServerSideProps?
In the Next.js Pages Router, `getStaticProps` and `getServerSideProps` dictate data fetching and page caching behavior: ### 1. `getStaticProps` (Static Site Generation): ...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (188 available).
In the Next.js Pages Router, `getStaticProps` and `getServerSideProps` dictate data fetching and page caching behavior: ### 1. `getStaticProps` (Static Site Generation): ...
A function that specifies dynamic routes to pre-render based on data. ```jsx export async function getStaticPaths() { const res = await fetch("https://.../posts"); const ...
Determines how to handle missing paths, with true, false, or 'blocking'. ```jsx export async function getStaticPaths() { const paths = await getAllPostIds(); return { pat...
By creating files in the `pages/api` directory, which will be treated as API endpoints. ```jsx // pages/api/hello.js export default function handler(req, res) { res.statu...
By creating a `_error.js` file in the `pages` directory. ```jsx // pages/_error.js export default function Error({ statusCode }) { return ( {statusCode ? `An error ${stat...
Yes, the Pages Router has some limitations compared to the App Router, such as: - Limited support for nested routes and layouts. - Less flexibility in handling server com...
By using libraries like `next-auth` or implementing custom authentication logic in API routes. ```jsx // pages/api/auth/[...nextauth].js import NextAuth from "next-auth";...
By creating a custom server or using API routes to implement middleware logic. ```js // pages/api/middleware.js export default function middleware(req, res, next) { // Cu...
By using client-side form handling or API routes for server-side handling. ```jsx // pages/contact.js export default function Contact() { const handleSubmit = async (e) =...
Yes, you can use features like static generation (SSG), server-side rendering (SSR), and incremental static regeneration (ISR) to optimize performance in the Pages Router...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.