Question · Next.js course · Module 2: Routing and Layouts

Difference Between template.tsx and layout.tsx

How does template.tsx differ from layout.tsx in Next.js App Router?

Answer options

  • template.tsx is faster than layout.tsx
  • template.tsx creates a new instance on every navigation, layout.tsx preserves state
  • template.tsx is only for Server Components, layout.tsx is for Client Components
  • template.tsx cannot contain HTML tags
Show the answer

Correct answer:

  • template.tsx creates a new instance on every navigation, layout.tsx preserves state