File conventions
Global error file
Global error is a Client Component that replaces the root shell on failure. Include independent html and body tags and any required styling. The example uses retry as documented for 16.3+; verify exact installed props. Source: https://nextjs.org/docs/app/api-reference/file-conventions/error. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.
Formal Syntax & Structure
nextjs syntaxnextjs
app/global-error.tsxWorking Example
Example Snippetnextjs
'use client';export default function GlobalError({retry}:{error:Error & {digest?:string};retry:()=>void}){ return <html lang='en'><body><main><h1>River Books is unavailable</h1><button type='button' onClick={()=>retry()}>Try again</button><p><a href='/'>Return home</a></p></main></body></html>;}