Next.js Discord

Discord Forum

getInitialProps function

Unanswered
Northeast Congo Lion posted this in #help-forum
Open in Discord
Avatar
Northeast Congo LionOP
next.js 13 function
I have a code with next 6.0.3 like that :

import React from 'react'
class Error extends React.Component {
static getInitialProps({ res, err }) {
const statusCode = res ? res.statusCode : err ? err.statusCode : null;
return { statusCode }
}
render() {
const { deviceInfo, statusCode } = this.props;
return (
<div className="viewport d-flex flex-column h-100">
//---------------------------------
</div>
)
}
}
export default Error;

but in next.js 13, ({res, err}) is error.
How can I treat this code in next.js 13 app directory?
Please help me!

1 Reply

Avatar
Northeast Congo LionOP
anyone?