# next--e-commerce **Repository Path**: sunmeng123/next--e-commerce ## Basic Information - **Project Name**: next--e-commerce - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: starter - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-18 - **Last Updated**: 2026-01-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Getting Started First, run the development server: ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` ## Lucide Icons pnpm install lucide-react ## Categories 组件 必须是客户端组件("use client") ```tsx const searchParams = useSearchParams(); const router = useRouter(); const pathname = usePathname(); ``` - 这三个 Hook(useSearchParams, useRouter, usePathname)只能在客户端组件中使用。 - 它们依赖浏览器的 window.location 和 History API,在服务器上无法运行。 ## ProductCard 组件 必须是客户端组件("use client") - 服务端组件无法维护状态。useState 是 React 客户端 Hook,只能在浏览器中运行。 - 用户切换尺码或颜色时,需要实时更新 UI,这依赖于组件内部的状态 📌 Next.js 规则:任何使用 useState, useEffect, useRef 等 React 客户端 Hook 的组件,必须标记为 "use client"。 ```tsx // 尺码选择