Template rendered at
2026-05-03T10:38:32.198Z — this stamp regenerates on every navigation, while the surrounding layout timestamp would be stable.template.tsx
template.tsx works like layout.tsx, but it
remounts on every navigation. Use it for per-page effects (page-view
pings, entry animations, fresh per-render state) where a stable
layout would be wrong.
Source
// src/app/examples/template-remount/template.tsx
export default function Template({ children }) {
const renderedAt = new Date().toISOString();
return (
<div>
<div>Template rendered at {renderedAt}</div>
{children}
</div>
);
}
// src/app/examples/template-remount/page.tsx
export default function Page() {
return <p>Page body — wrapped in template.tsx</p>;
}