Question · Next.js course · Module 2: Routing and Layouts
Error Boundary with error.tsx
Why must the error.tsx file in Next.js 16 be a Client Component (with the 'use client' directive)?
Answer options
- Because Server Components do not support CSS imports
- Because React's error boundary requires lifecycle methods available only on the client side
- Because error files can only exist in the /pages folder
- Because Next.js automatically converts every error.tsx to a Server Component
Show the answer
Correct answer:
- Because React's error boundary requires lifecycle methods available only on the client side