19 / 24

What is the hierarchy of all routing files?

The React components defined in special files of a route segment are rendered in a specific hierarchy:

  1. 1

    layout.js

  2. 2

    template.js

  3. 3

    error.js (React error boundary)

  4. 4

    loading.js (React suspense boundary)

  5. 5

    not-found.js (React error boundary)

  6. 6

    page.js or nested layout.js