ข้ามไปยังเนื้อหา

Tooling, Testing & Production

คุณเข้าใจแล้วว่า React render อย่างไรและ hooks ทำงานอย่างไร โมดูลนี้ว่าด้วยทุกอย่างรอบ ๆ code: เริ่มโปรเจกต์วันนี้อย่างไร, test component อย่างไร, type อย่างไร และใช้อะไรตอน production

จุดสำคัญเรื่อง currency: Create React App ถูก deprecated แล้ว (sunset อย่างเป็นทางการในปี 2025) React ปัจจุบันเริ่มด้วย Vite สำหรับ SPA หรือ framework (Next.js, React Router) สำหรับอะไรก็ตามที่ต้องการ routing, SSR หรือ Server Components

บทเรียนสิ่งที่คุณจะได้เรียน
Project & toolingVite เทียบกับ framework, DevTools, Fast Refresh — และทำไมไม่ใช้ CRA
TestingReact Testing Library บน Vitest, test behavior ไม่ใช่ internal
TypeScript with Reacttype props, hooks, event — และ ref เป็น prop ใน React 19
Production & ecosystemcode-splitting และ library ที่คุณจะใช้จริง
flowchart TB
  build["Build tool
(Vite) or framework
(Next.js / React Router)"] --> app["React app ของคุณ"]
  ts["TypeScript"] --> app
  test["Testing Library + Vitest"] --> app
  eco["Ecosystem:
routing, data, forms, state"] --> app
สิ่งที่อยู่รอบ ๆ component ในโปรเจกต์จริง

ไม่มีอันไหนเป็นตัว React เอง — React ตั้งใจเป็น library ไม่ใช่ framework คุณจึงประกอบส่วนที่เหลือเอง การรู้ตัวเลือกมาตรฐานช่วยให้ไม่ต้องคิดใหม่เอง

สถานะปัจจุบันของ Create React App คืออะไร?
ควรเริ่ม React single-page app สมัยใหม่อย่างไร?
ทำไมต้องประกอบ toolchain รอบ React เอง?