Skip to content

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

Merged
rauchg merged 1 commit into
masterfrom
add/error-override
Oct 15, 2016
Merged

rauchg merged 1 commit into
masterfrom
add/error-override

Conversation

@impronunciable

Copy link
Copy Markdown
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
Comment thread Readme.md
import React from 'react'
export default ({ statusCode }) => (
<p>An error { statusCode } occurred</p>
)

Copy link
Copy Markdown
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
Copy Markdown
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.

3 participants