error.js defines the error boundary for a route segment and the children below it. It can be used to show specific error information, and functionality to attempt to recover from the error.
Trying navigation pages and triggering an error inside nested layouts. Notice how the error is isolated to that segment, while the rest of the app remains interactive.