-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Document next/error #1134
Comments
Yeah! Let's add it. |
Isn't Or am I missing something 😕? Maybe the fact that we can import and render it from any page is what you mean? 💡 Anyways I'll open a PR for #1069 and other documentation improvements, soon. Let me know and I'll add it to the list. |
Yay, thanks! It's on the list. 🗒 |
Thank you very much @nikvm 👍 |
@nikvm added the in progress label. |
Something like this should suffice. import React from 'react'
import Error from 'next/error'
import fetch from 'isomorphic-fetch'
export default class Page extends React.Component {
static async getInitialProps () {
const res = await fetch('https://api.github.com/repos/zeit/next.js')
const statusCode = res.statusCode > 200 ? res.statusCode : false
const json = await res.json()
return { statusCode, stars: json.stargazers_count }
}
render () {
if(this.props.statusCode) {
return <Error statusCode={this.props.statusCode} />
}
return (
<div>Next stars: {this.props.stars}</div>
)
}
} |
I don't think it's documented anywhere?
Also (unrelated to title, sorry), I guess it doesn't support any kind of message localization.
The text was updated successfully, but these errors were encountered: