TSX file
A TypeScript file that may contain JSX markup, used for React components such as page.tsx.
In more detail
The x stands for JSX. Next.js special files such as page.tsx, layout.tsx and error.tsx use this extension because they return JSX, while files without markup, such as route.ts or middleware.ts, use .ts.
Related terms
- JSX — The HTML-like syntax used in React code, such as <Button size="lg">Save</Button>, which compiles to JavaScript function calls.
- TypeScript — JavaScript with added type annotations, checked by a compiler before the code runs.
- file convention — A file name that Next.js gives a special meaning, such as page.tsx for a route's content or error.tsx for its error screen.
Taught in
- Templates vs Layouts: Remounting & Page Transitions — Next.js 15 & Modern App Router Architecture
- Parallel & Intercepting Routes: Modals & Split Views — Next.js 15 & Modern App Router Architecture
- Loading UI: Instant Loading States with loading.tsx — Next.js 15 & Modern App Router Architecture
- Granular Suspense: Resolving Waterfall Bottlenecks — Next.js 15 & Modern App Router Architecture
- Error Boundaries: Nested error.tsx & Reset Logic — Next.js 15 & Modern App Router Architecture
- Not Found Handling: not-found.tsx & Programmatic Exits — Next.js 15 & Modern App Router Architecture