import React, {Component} from "react"; class ErrorBoundary extends Component { state = { error: null, }; static getDerivedStateFromError(error) { return {error}; } render() { const { error } = this.state; if (error) { return
Что-то пошло не так =( {error}
; } return this.props.children; } } export default ErrorBoundary