Next.js Discord

Discord Forum

Error handling in Next.js 15

Unanswered
Cornish Rex posted this in #help-forum
Open in Discord
Cornish RexOP
Hello, I am beginner. So in order to display error I must create error.tsx for selected page, but what if I have multiple different components in that page and want to display different error ui-s in same page for different nested components how do I achieve that? Should I use parallel routing?

8 Replies

@Yi Lon Ma you need react's error boundary for this case
Cornish RexOP
Got it, thanks.
Also for example if I have a state to catch an error and if error occurs to return UI, it is wrong approach right?
Cornish RexOP
Yes
@Cornish Rex Yes
then I don't think there's much you can do