This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
learningpulse/web-client/app/error.tsx

32 lines
548 B
TypeScript
Raw Normal View History

2024-09-05 17:07:07 +02:00
"use client";
import { useEffect } from "react";
export default function Error({
error,
reset,
}: {
error: Error;
reset: () => void;
}) {
useEffect(() => {
// Log the error to an error reporting service
/* eslint-disable no-console */
console.error(error);
}, [error]);
return (
<div>
<h2>Something went wrong!</h2>
<button
onClick={
// Attempt to recover by trying to re-render the segment
() => reset()
}
>
Try again
</button>
</div>
);
}