UNPKG

communication-react-19

Version:

React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)

29 lines 805 B
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import React from 'react'; /** * @internal * ErrorBoundary component to handle errors in React components. */ export class _ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError() { // Update state so the next render will show the fallback UI. return { hasError: true }; } componentDidCatch(error) { console.error(error); } render() { if (this.state.hasError) { // handle error return this.props.fallback; } // otherwise render children return this.props.children; } } //# sourceMappingURL=ErrorBoundary.js.map