build.log
Quay lai ghi chu
Architecture
Cap nhat 19 thg 2, 2026

Clean Code Principles for Frontend

Practical clean code principles applied to frontend development: naming, structure, and organization.

clean-code
architecture
best-practices

Naming - Components: PascalCase, noun-based (UserProfile, TaskList) - Hooks: camelCase, use-prefixed (useAuth, useDebounce) - Utils: camelCase, verb-based (formatDate, validateEmail) - Constants: SCREAMING_SNAKE_CASE (MAX_RETRIES, API_BASE_URL)

File Structure - Group by feature, not by type - Keep files focused (single responsibility) - Co-locate tests with source files - Index files for clean exports

Functions - Do one thing well - Maximum 3 parameters (use objects for more) - Return early to reduce nesting - Extract complex conditions into named booleans