Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented missing pieces for overriding 404 and 500 pages. #10

Merged
merged 1 commit into from
Oct 15, 2016

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.

None yet

3 participants