Rendering behavior of defaultErrorComponent vs notFoundComponent inside the root route
#1107
Unanswered
GuillaumeLaroucheUQAT
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Throwing an error inside the component of a route will replace it by it's
errorComponentor thedefaultErrorComponent. However, throwing thenotFound()function inside a loader will either replace the component by it'snotFoundComponentor the entire route tree by thenotFoundComponentdefined inside the root route.Is there a way to define a default
notFoundComponentthat has the same behavior has thedefaultErrorComponent? I've noticed that there's anglobalNotFoundproperty in the router options, but it doesn't seem to work likedefaultErrorComponent.A current workaround is to duplicate the content of the component inside the
notFoundComponentbut it's not elegant.Example inside the
__root.tsx:Maybe a solution could be to use the
InnerWrapprop in the router options, but it would render the component on every route and limit the ability to replace the component based on the route in the future.Beta Was this translation helpful? Give feedback.
All reactions