template.tsx
A special file like layout.tsx that wraps its children but is created fresh on every navigation, so its state resets.
In more detail
Use a template for enter animations, per-page logging or forms that must clear between steps. A layout in the same folder wraps the template.
Related terms
- layout.tsx — The special file that wraps a segment and all its children in shared UI that stays mounted while you navigate between them.
- remount — Removing a component from the page and creating it again from scratch, which resets its state and re-runs its effects.
- CSS animation — Changing an element's styles smoothly over time using @keyframes and the animation property, without JavaScript.
Taught in
- Templates vs Layouts: Remounting & Page Transitions — Next.js 15 & Modern App Router Architecture