Replies: 2 comments
-
@gleich Maybe you could copy paste here your TS version? |
Beta Was this translation helpful? Give feedback.
0 replies
-
import { NextPageContext } from 'next'
const Error = ({statusCode}: {statusCode: number}): JSX.Element => {
const msg = statusCode ? ' error occured' : 'error occured on client'
return (
<main>
<div>{statusCode} {msg}</div>
</main>
)
}
Error.getInitialProps = ({ res, err }: NextPageContext) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404
return { statusCode }
}
export default Error |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the feature you'd like to request
I love the TypeScript docs but it seems as though the Custom Error Page page seems to be missing a working example. I was able to put together a typescript version of this file and I think it would be helpful for others if it was included in the documentation.
Describe the solution you'd like
I would love to add an example! Just having an example of it in a similar fashion to the other TypeScript examples.
Describe alternatives you've considered
N/A
Beta Was this translation helpful? Give feedback.
All reactions