Trung BìnhNext.js iconNext.js

Layouts trong Next.js App Router là gì?

Layout là UI chia sẻ giữa nhiều pages, preserve state khi navigate (không remount). layout.tsx nhận children prop.

  • Nested layouts: layout lồng trong layout tạo hierarchy.
  • Root layout (app/layout.tsx) bắt buộc phải có, wrap toàn app.
  • Khác với template.tsx: template remount mỗi navigate.

Xem toàn bộ Next.js cùng filter theo level & chủ đề con.

Mở danh sách Next.js