MCPcopy
hub / github.com/react/react / isErrorBoundary

Function isErrorBoundary

packages/react-devtools-shared/src/backend/fiber/renderer.js:6393–6408  ·  view source on GitHub ↗
(fiber: Fiber)

Source from the content-addressed store, hash-verified

6391 }
6392
6393 function isErrorBoundary(fiber: Fiber): boolean {
6394 const {tag, type} = fiber;
6395
6396 switch (tag) {
6397 case ClassComponent:
6398 case IncompleteClassComponent:
6399 const instance = fiber.stateNode;
6400 return (
6401 typeof type.getDerivedStateFromError === 'function' ||
6402 (instance !== null &&
6403 typeof instance.componentDidCatch === 'function')
6404 );
6405 default:
6406 return false;
6407 }
6408 }
6409
6410 function inspectElementRaw(id: number): InspectedElement | null {
6411 const devtoolsInstance = idToDevToolsInstanceMap.get(id);

Callers 3

inspectFiberInstanceRawFunction · 0.85
overrideErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected