# การดึงข้อมูล Next.js (React / Next.js) > Server-side rendering (SSR), การสร้างหน้าแบบสถิต (SSG), การสร้างใหม่แบบสถิตเพิ่มขึ้น (ISR), streaming - 24 คำถามสัมภาษณ์ - Mid-Level - [คำถามสัมภาษณ์: React / Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions.md) ## 1. พฤติกรรมเริ่มต้นของ Server Components ใน Next.js App Router สำหรับการดึงข้อมูลคืออะไร? **คำตอบ** Server Components ดำเนินการดึงข้อมูลบนเซิร์ฟเวอร์ในทุกคำขอตามค่าเริ่มต้น ทำให้มั่นใจได้ว่าข้อมูลจะสดใหม่เสมอ ต่างจาก Pages Router ที่ต้องใช้ getServerSideProps Server Components ทำให้ SSR เป็นแบบนัย สำหรับการแคชแบบสถิต ต้องเพิ่มตัวเลือก cache: 'force-cache' ใน fetch ## 2. ตัวเลือก cache ของ fetch ใดที่เทียบเท่ากับ getStaticProps ใน Pages Router? **คำตอบ** ตัวเลือก cache: 'force-cache' บอก Next.js ให้แคชการตอบสนองจนกว่าจะถูกยกเลิกการใช้งานด้วยตนเอง ซึ่งเทียบเท่ากับ getStaticProps กลยุทธ์นี้สร้างเนื้อหาแบบสถิตที่ยังคงถูกแคชไว้อย่างไม่มีกำหนด ตัวเลือก 'no-store' เท่ากับ getServerSideProps (re-fetch ทุกคำขอ) ในขณะที่ next.revalidate เท่ากับ getStaticProps ที่มี revalidate (ISR) ## 3. จะบังคับการดึงข้อมูลแบบไดนามิกในทุกคำขออย่างไร (เทียบเท่ากับ getServerSideProps)? **คำตอบ** ตัวเลือก cache: 'no-store' ปิดการแคชทั้งหมดและบังคับให้ดึงข้อมูลใหม่ในทุกคำขอ เทียบเท่ากับ getServerSideProps กลยุทธ์นี้รับประกันข้อมูลที่สดใหม่เสมอแต่เพิ่มเวลาหน่วง ใช้สำหรับข้อมูลแบบเรียลไทม์ (dashboard, การแจ้งเตือน, ราคาสด) ที่ความสดใหม่สำคัญ ## มีอีก 21 คำถาม - จะนำ ISR (Incremental Static Regeneration) มาใช้งานด้วยการ revalidation ทุกชั่วโมงได้อย่างไร? - 'export const revalidate = 60' ที่ระดับหน้าทำอะไร? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ React / Next.js อื่นๆ - [พื้นฐาน JavaScript](https://sharpskill.dev/th/technologies/react-next/interview-questions/javascript-essentials.md): 25 คำถาม, Junior - [พื้นฐาน React](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-fundamentals.md): 20 คำถาม, Junior - [React Hooks](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-hooks.md): 22 คำถาม, Junior - [วงจรชีวิตของ component](https://sharpskill.dev/th/technologies/react-next/interview-questions/component-lifecycle.md): 18 คำถาม, Junior - [React Router](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-router.md): 20 คำถาม, Junior - [การจัดการ state ด้วย Context](https://sharpskill.dev/th/technologies/react-next/interview-questions/state-management-context.md): 18 คำถาม, Junior - [ฟอร์มและ Controlled Components](https://sharpskill.dev/th/technologies/react-next/interview-questions/forms-controlled-components.md): 20 คำถาม, Mid-Level - [การดึงข้อมูลและ API](https://sharpskill.dev/th/technologies/react-next/interview-questions/fetching-data-api.md): 20 คำถาม, Mid-Level - [React Query (TanStack Query)](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-query-tanstack.md): 20 คำถาม, Mid-Level - [Styling & CSS-in-JS](https://sharpskill.dev/th/technologies/react-next/interview-questions/styling-css-in-js.md): 18 คำถาม, Mid-Level - [พื้นฐาน Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-fundamentals.md): 25 คำถาม, Mid-Level - [TypeScript กับ React](https://sharpskill.dev/th/technologies/react-next/interview-questions/typescript-react.md): 20 คำถาม, Mid-Level - [Server Actions ของ Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-server-actions.md): 20 คำถาม, Mid-Level - [การกำหนดเส้นทางและการนำทางใน Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-routing-navigation.md): 22 คำถาม, Mid-Level - [API Routes ใน Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-api-routes.md): 20 คำถาม, Mid-Level - [Metadata & SEO ใน Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-metadata-seo.md): 18 คำถาม, Mid-Level - [Middleware และ Auth ใน Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-middleware-auth.md): 22 คำถาม, Mid-Level - [การทดสอบ React](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-testing.md): 20 คำถาม, Mid-Level - [Zustand State Management](https://sharpskill.dev/th/technologies/react-next/interview-questions/zustand-state-management.md): 18 คำถาม, Mid-Level - [การเพิ่มประสิทธิภาพ React](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-performance-optimization.md): 22 คำถาม, Senior - [Error Boundaries & การจัดการข้อผิดพลาด](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-error-boundaries.md): 18 คำถาม, Senior - [Advanced React Patterns](https://sharpskill.dev/th/technologies/react-next/interview-questions/advanced-react-patterns.md): 20 คำถาม, Senior - [ฟีเจอร์ขั้นสูงของ Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-advanced-features.md): 24 คำถาม, Senior - [การ Deploy & Production ของ Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-deployment-production.md): 20 คำถาม, Senior - [Architecture & Design Patterns](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-architecture-patterns.md): 22 คำถาม, Senior - [React Server Components](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-server-components.md): 26 คำถาม, Senior - [การแปลภาษา Next.js](https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-internationalization.md): 20 คำถาม, Senior - [React ความปลอดภัย & แนวปฏิบัติที่ดีที่สุด](https://sharpskill.dev/th/technologies/react-next/interview-questions/react-security-best-practices.md): 22 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/react-next/interview-questions/nextjs-data-fetching