595ecdbfdc
## Feature NEXT-54 When there's an error in the one of the root level pages, there's no way to handle it. The team discussed this and decided there should be a global error boundary to pick up anything not handled further down in the tree. It can be called `global-error.js`. Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
20 lines
345 B
JavaScript
20 lines
345 B
JavaScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
|
|
export default function Page() {
|
|
const [clicked, setClicked] = useState(false)
|
|
if (clicked) {
|
|
throw new Error('Client error')
|
|
}
|
|
return (
|
|
<button
|
|
id="error-trigger-button"
|
|
onClick={() => {
|
|
setClicked(true)
|
|
}}
|
|
>
|
|
Trigger Error!
|
|
</button>
|
|
)
|
|
}
|