TypeScriptInjection & inputDifficulty 2/3
// app/receipts/viewer.tsx
"use client";
import { useEffect } from "react";
// Shows the receipt reference passed in the URL, e.g. /receipts#REF-2026-0042
export function ReceiptViewer() {
useEffect(() => {
const ref = decodeURIComponent(window.location.hash.slice(1));
const target = document.getElementById("receipt");
if (target) {
target.innerHTML = "<p>Showing receipt <strong>" + ref + "</strong></p>";
}
}, []);
return <div id="receipt" />;
}