Error Boundary
error.tsx catches runtime errors and shows a fallback with retry, without breaking the rest of the app.This component works normally... until you click the button.
What does this show?
- ‣
error.tsxacts as an automatic React Error Boundary - ‣It must be
"use client"because React needs to hydrate it - ‣It receives
errorandreset(retry function) - ‣It only affects the route segment; layout and other pages keep working
- ‣Click "Throw error" to see it in action