/**
 * Error element for the /error/[code] route.
 *
 * React Router renders this when the route's loader throws a Response
 * to set the correct HTTP status code (TZ §4.1.21).
 * Reads the error code from the URL to render the branded page.
 */

import { useParams } from "@modern-js/runtime/router";
import { ErrorPage } from "@/ui/errors/ErrorPage.js";

export default function ErrorCodeElement(): JSX.Element {
  const { code } = useParams<{ code: string }>();
  return <ErrorPage {...(code ? { code } : {})} />;
}
