import React from "react"; interface ErrorPageProps { statusCode: number }; export default function Error(props: ErrorPageProps) { return (

{props.statusCode ? `An error ${props.statusCode} occurred on server` : "An error occurred on client"}

) } export const getInitialProps = ({ res, err }) => { const statusCode = res ? res.statusCode : err ? err.statusCode : 404 return { props: { statusCode } }; };