Đỗ Hải Nam
feat(frontend): interactive chat UI with math rendering
471f166
raw
history blame contribute delete
642 Bytes
import React from 'react'
class ErrorBoundary extends React.Component {
constructor(props) {
super(props)
this.state = { hasError: false }
}
static getDerivedStateFromError(error) {
return { hasError: true }
}
componentDidCatch(error, errorInfo) {
console.error("Markdown rendering error:", error, errorInfo)
}
render() {
if (this.state.hasError) {
return this.props.fallback || <span className="text-red-500 text-sm">⚠️ Không thể hiển thị nội dung này</span>
}
return this.props.children
}
}
export default ErrorBoundary