-
-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Description
Similar to how ssrContext.redirectTo is used, it would be useful to be able to specify an HTTP status code on a Route component like this:
<>
<Link to='/'>Home</Link>
<Link to='test'>Test</Link>
<Switch>
<Route path='test' statusCode={200}>
<Test />
</Route>
<Route path='/' statusCode={200}>
<Home />
</Route>
<Route statusCode={404}>
<NotFound />
</Route>
</Switch>
</>and have that status code show up as ssrContext.statusCode. (If not set, it should default to 200 or remain undefined.) This would primarily be useful in the NotFound case, but other use cases may also arise. React's renderToReadableStream proposes throwing Error's to be caught by an onError handler which either interrupts server side rendering or requires wrapping the throwing component in a Suspense component.
Metadata
Metadata
Assignees
Labels
No labels