You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
405 B
JavaScript

import React from 'react'
import ErrorDisplay from '~/components/errorDisplay'
export default class ErrorBoundary extends React.Component {
constructor(props) {
super()
this.state = {error: null};
}
getDerivedStateFromError(error){
return {error}
}
render() {
if(this.state.error)
return <ErrorDisplay error={this.state.error} />
return this.props.children;
}
}