strapi-nextgen-framework
Version:
Production-ready, type-safe framework bridging Strapi v4 CMS and Next.js 14+ App Router with automatic cache management, Error Boundaries, and SEO optimization
32 lines • 1.08 kB
TypeScript
/**
* Error Boundary for individual Strapi components
* Prevents single component failure from crashing entire page
*/
import { Component, type ReactNode, type ErrorInfo } from 'react';
interface ErrorBoundaryProps {
children: ReactNode;
componentType: string;
onError?: (error: Error, errorInfo: ErrorInfo, componentType: string) => void;
fallback?: ReactNode;
}
interface ErrorBoundaryState {
hasError: boolean;
error: Error | null;
}
/**
* Error Boundary that wraps each dynamic component
*
* Features:
* - Catches React errors in child components
* - Logs errors in development mode
* - Shows fallback UI or hides component in production
* - Calls optional onError callback
*/
export declare class ComponentErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
constructor(props: ErrorBoundaryProps);
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
render(): ReactNode;
}
export {};
//# sourceMappingURL=error-boundary.d.ts.map