UNPKG

react-okr-ui

Version:

A React user interface toolkit for building OKR centric applications.

24 lines (17 loc) 408 B
import React from "react" class ErrorBoundary extends React.Component { state = { hasError: false } componentDidCatch(error) { this.props.onError(error) } componentDidMount() { this.props.clearErrors() } static getDerivedStateFromError() { return { hasError: true } } render() { return this.state.hasError ? null : this.props.children } } export default ErrorBoundary