A Collection of reusable React Error Pages
npm install @bugpilot/react-error-pages``bash`
pnpm add @bugpilot/react-error-pages
In app/error.tsx and app/**/error.tsx:
`jsx
"use client";
import "@bugpilot/react-error-pages/dist/index.css";
import { BasicErrorPage } from "@bugpilot/react-error-pages";
export default BasicErrorPage;
`
In app/global-error.tsx:
`tsx
"use client";
import { Bugpilot } from "@bugpilot/plugin-nextjs";
import { BasicErrorPage } from "@bugpilot/react-error-pages";
export default function GlobalErrorPage({
children,
...props
}: React.PropsWithChildren<{
error: Error & { digest?: string };
reset: () => void;
}>) {
// Global Error also catch root layout errors
// so we need to render the html and body tags here
return (
Usage in React
Wrap your components with an Error Boundary, and render an error page component in the
renderError` method.MIT