Skip to content

Commit 8578038

Browse files
remytimneutkens
authored andcommitted
Change _error.js example to use err prop (vercel#3197)
The `jsonPageRes` isn't always there, whereas `err` is, and when used, provides a consistent statusCode in the client when compared to the server.
1 parent 741f211 commit 8578038

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,10 +849,8 @@ __Note: React-components outside of `<Main />` will not be initialised by the br
849849
import React from 'react'
850850

851851
export default class Error extends React.Component {
852-
static getInitialProps({ res, jsonPageRes }) {
853-
const statusCode = res
854-
? res.statusCode
855-
: jsonPageRes ? jsonPageRes.status : null
852+
static getInitialProps({ res, err }) {
853+
const statusCode = res ? res.statusCode : err ? err.statusCode : null;
856854
return { statusCode }
857855
}
858856

0 commit comments

Comments
 (0)