First App Router page
An App Router page is the UI for a route. A file named page.tsx in the app directory exports a component as its default export. JSX looks like HTML, but it is a syntax for describing UI in JavaScript or TypeScript. This example assumes a compatible project; setup follows in Chapter 3.
A page with useful content
// app/page.tsxexport default function Home() { return ( <main> <h1>River Books</h1> <p>Find your next weekend read.</p> </main> )}At the root path, the intended page has a main landmark, a heading and a paragraph. The default export is the component the framework selects. The component name Home is a readable local name, not the URL.
A small variation
To create a catalog route, place a similar default-exported component in app/catalog/page.tsx. Its heading can be Catalog. The original home file remains at /. Both routes need the root layout described later.
Common mistake
A random component file does not register a page merely because it returns JSX. Use the reserved page filename at the intended segment.
Try it yourself
On paper, change the page to introduce a library. Predict the visible heading and paragraph.
Example status: static walkthrough; Next.js build and browser behavior have not been executed in this authoring environment.