1---2name: react3description: React Skill4---5# React Skill67> Loaded by: Frontend Division agents | Version: 1.089## Best Practices1011### Component Structure1213- Use functional components with hooks (no class components)14- Keep components under 200 lines; one component per file15- Co-locate related files (component, styles, tests, types)1617### Hooks1819- Custom hooks for reusable logic (prefix with `use`)20- `useState` for simple local state; `useReducer` for complex state21- `useEffect` cleanup to prevent memory leaks22- `useMemo`/`useCallback` only when measurably needed2324### Performance2526- React.lazy for route-level code splitting27- React.memo for expensive pure components28- Avoid inline object/array creation in JSX props29- Use stable keys in lists (never array index)3031### Pattern3233```tsx34interface UserCardProps {35 name: string;36 email: string;37 onEdit?: () => void;38}3940const UserCard: React.FC<UserCardProps> = ({ name, email, onEdit }) => (41 <div className="user-card">42 <h3>{name}</h3>43 <p>{email}</p>44 {onEdit && <button onClick={onEdit}>Edit</button>}45 </div>46);4748export default UserCard;49```5051## Anti-Patterns5253- Do NOT use `any` type54- Do NOT mutate state directly55- Do NOT put business logic in components56- Do NOT use `useEffect` for derived state57- Do NOT create components inside render5859## Checklist6061- [ ] Component is typed with TypeScript interfaces62- [ ] Props have sensible defaults63- [ ] No `any` types64- [ ] Effects have cleanup functions where needed65- [ ] Component is under 200 lines66- [ ] Error boundaries wrap risky components
Run npx skillmds@latest add ab-aswini/react in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
React Skill It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Ab-aswini (@ab-aswini) published this skill. Their other Agent Skills are listed on their SkillMD profile.