Put in order · Next.js course · Module 2: Routing and Layouts

Error Handling in error.js

Arrange the order of handling an error with the error.js file

Items to put in order

  • Clicking the button with reset() renders the segment again
  • The nearest error boundary from error.js catches the error
  • The page component throws an error while rendering
  • Next.js shows the error.js component instead of the segment
Show the answer

Correct order:

  1. The page component throws an error while rendering
  2. The nearest error boundary from error.js catches the error
  3. Next.js shows the error.js component instead of the segment
  4. Clicking the button with reset() renders the segment again