MCPcopy Create free account
hub / github.com/testing-library/react-testing-library / ErrorBoundary

Class ErrorBoundary

src/__tests__/error-handlers.js:56–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 const handleComponentDidCatch = jest.fn()
55 const onCaughtError = jest.fn()
56 class ErrorBoundary extends React.Component {
57 state = {error: null}
58 static getDerivedStateFromError(error) {
59 return {error}
60 }
61 componentDidCatch(error, errorInfo) {
62 handleComponentDidCatch(error, errorInfo)
63 }
64 render() {
65 if (this.state.error) {
66 return null
67 }
68 return this.props.children
69 }
70 }
71 function Thrower() {
72 throw thrownError
73 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…