React components and props
A component is a reusable description of UI. Props are inputs from a parent. In a Next.js page, a small book card can render different titles without duplicating markup. Treat props as read-only values. React handles component rendering; Next.js handles the route conventions around the page.
Reuse a title card
type BookCardProps = { title: string };function BookCard({ title }: BookCardProps) { return <article><h2>{title}</h2></article>}export default function Page() { return <main><h1>Catalog</h1><BookCard title="Moss" /><BookCard title="Harbor" /></main>}The intended heading sequence is Catalog, Moss, Harbor. Each card receives a different title. The braces inside JSX read a JavaScript value; the braces in the function parameter extract the title property.
Composition and identity
A component may live in the page file or an imported module. When a list is generated using map, supply stable keys from the data so React can match sibling items. A key is used for React identity among siblings, not authorization or a normal prop for the card. Use a stable book ID or slug rather than a random value or an array position when items can reorder. Pass an ID separately if BookCard needs it. Render logic should not mutate the supplied props.
Common mistake
Do not call a component as an ordinary function to bypass React rendering. Render it using JSX and let React manage its identity.
Try it yourself
Add an author prop to BookCard and render it as a paragraph below the heading.
Example status: static walkthrough; Next.js build and browser behavior have not been executed in this authoring environment.