| 1 | "use client"; |
| 2 | |
| 3 | import { Component, ReactNode } from "react"; |
| 4 | |
| 5 | interface Props { |
| 6 | children: ReactNode; |
| 7 | } |
| 8 | |
| 9 | interface State { |
| 10 | hasError: boolean; |
| 11 | } |
| 12 | |
| 13 | class OrganismBoundary extends Component<Props, State> { |
| 14 | constructor(props: Props) { |
| 15 | super(props); |
| 16 | this.state = { hasError: false }; |
| 17 | } |
| 18 | |
| 19 | static getDerivedStateFromError(): State { |
| 20 | return { hasError: true }; |
| 21 | } |
| 22 | |
| 23 | componentDidCatch(error: Error) {} |
| 24 | |
| 25 | render() { |
| 26 | if (this.state.hasError) return null; |
| 27 | return this.props.children; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | export default OrganismBoundary; |