MCPcopy Index your code
hub / github.com/resend/react-email / createErrorBoundary

Function createErrorBoundary

packages/render/src/shared/error-boundary.tsx:3–19  ·  view source on GitHub ↗
(reject: (error: unknown) => void)

Source from the content-addressed store, hash-verified

1import React from 'react';
2
3export function createErrorBoundary(reject: (error: unknown) => void) {
4 // React Server Components don't support React.Component, so it's just not defined here
5 if (!React.Component) {
6 return (props: { children?: React.ReactNode }) => <>{props.children}</>;
7 }
8
9 return class ErrorBoundary extends React.Component<{
10 children: React.ReactNode;
11 }> {
12 componentDidCatch(error: unknown) {
13 reject(error);
14 }
15 render() {
16 return this.props.children;
17 }
18 };
19}

Callers 3

renderFunction · 0.90
renderFunction · 0.90
renderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected