Next.js
Next.js enables you to create high-quality web applications with the power of React components.
npx create-next-app@15.5.2
What is your project named? my-first-next-app
Would you like to use TypeScript? Yes
Which linter would you like to use? ESLint
Would you like to use Tailwind CSS? Yes
Would you like your code inside a `src/` directory? Yes
Would you like to use App Router? (recommended) Yes
Would you like to use Turbopack? (recommended) Yes
Would you like to customize the import alias (`@/*` by default)? NoNext.js
Next.js
npm run build
npm run startNext.js
Next.js
[id]{ params: Promise<{ id: string }> }
💥 Let's see this in action!
/* Dynamic route segment example
* e.g. folder src/app/products/[id]/page.tsx
*/
export default async function ProductDetailPage({
params,
}: {
params: Promise<{ id: string }>;
}) {
const p = await params;
const id = p.id;
const response = await fetch(`https://dummyjson.com/products/${id}`, {
cache: "no-store",
});
const product = await response.json();
return <h2>{product.title}</h2>;
}
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
💥 Let's see this in action!
Next.js
Next.js
We recommend using global styles for truly global CSS (like Tailwind's base styles), Tailwind CSS for component styling, and CSS Modules for custom scoped CSS when needed.
- Source: Official Next.js docs