Skip to content

Conversation

@impronunciable
Copy link
Contributor

No description provided.

@rauchg rauchg merged commit e527098 into master Oct 15, 2016
@rauchg rauchg deleted the add/error-override branch October 15, 2016 22:37
import React from 'react'
export default ({ statusCode }) => (
<p>An error { statusCode } occurred</p>
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like to give specific predefined props for _error.js.
Instead, I think you can just add getInitialProps and get statusCode as props if you want.

export default class Error extends React.Component {
  static getInitialProps ({ res, xhr }) {
    const statusCode = res ? res.statusCode : xhr.status
    return { statusCode }
  }
  ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#12 Revert this and adds this example to the readme

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants