aboutsummaryrefslogtreecommitdiff
path: root/src/app/error.jsx
blob: 75499259906006936a1e8f2a1efbe696ad116201 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"use client"; // Error components must be Client Components

import { useEffect } from "react";
import styles from "./globals.module.css";

export default function Error({ error, reset }) {
	useEffect(() => {
		console.log(error);
	}, [error]);

	return (
		<div className={styles.ErrorContainer}>
			<p>Something went wrong!</p>
			<button
				onClick={
					// Attempt to recover by trying to re-render the segment
					() => reset()
				}
			>
				Try again
			</button>
		</div>
	);
}