Files
medusa-store/www/reference/.cache/fast-refresh-overlay/components/error-boundary.js
2022-12-07 20:28:32 +01:00

15 lines
327 B
JavaScript

import * as React from "react"
export class ErrorBoundary extends React.Component {
state = { error: null }
componentDidCatch(error) {
this.setState({ error })
}
render() {
// Without this check => possible infinite loop
return this.state.error && this.props.hasErrors ? null : this.props.children
}
}