onComponentDidCatch property
An optional callback that will be called with an Error (or Exception)
and errorInfo
containing information about which component in the tree
threw when the componentDidCatch
lifecycle method is called.
This callback can be used to log component errors like so:
(ErrorBoundary()
..onComponentDidCatch = (error, errorInfo) {
// It is up to you to implement the service / thing that calls the service.
logComponentStackToAService(error, errorInfo);
}
)(
// The rest of your component tree
)
See: reactjs.org/docs/react-component.html#componentdidcatch
Related: onComponentIsUnrecoverable
Implementation
Function(/*Error||Exception*/dynamic error, ReactErrorInfo info)? onComponentDidCatch;