rsnext/test/e2e/app-dir/global-error/app/throw/page.js
Jiachi Liu 595ecdbfdc
feat: app dir error-global component (#44066)
## 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>
2022-12-16 11:04:43 +00:00

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>
)
}