import React from 'react' import ErrorPage from '~/pages/_error' export default class ErrorBoundary extends React.Component { constructor(props) { super() this.state = {error: null}; } static getDerivedStateFromError(error){ return {error: error || {name: 'Not found', message: 'This page could not be found'}} } render() { if(this.state.error) return return this.props.children; } }