1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/packages/next/client/error-boundary.js

16 lines
323 B
JavaScript
Raw Permalink Normal View History

import React from 'react'
class ErrorBoundary extends React.Component {
componentDidCatch (error, info) {
const {onError} = this.props
// onError is required
onError(error, info)
}
render () {
const {children} = this.props
return React.Children.only(children)
}
}
export default ErrorBoundary