frontend-react
Installation
SKILL.md
React Conventions
Naming Conventions
- Components: PascalCase —
UserProfile,OrderList - Component files: PascalCase matching the component name —
UserProfile.tsx,OrderList.tsx - Hook files:
useXxx.ts—useAuth.ts,useCart.ts - Constants:
UPPER_SNAKE_CASE—MAX_RETRY_COUNT,API_BASE_URL(avoid PascalCase to prevent confusion with components) - Event handler props:
onXxx—onClick,onSubmit,onStatusChange - Event handler implementations:
handleXxx—handleClick,handleSubmit
Component Design
- One component per file (default): Prefer one exported component per file. If the project's existing convention allows co-located internal sub-components in the same file, follow that convention — but never put multiple reusable public components in the same file
- Function Components only: Use Function Components, avoid Class Components
- Hook priority: Prioritize using hooks to manage state and side effects
- Single Responsibility: Each component focuses on a single responsibility