Component Architecture - Tectonica-Campaigns-Solutions/Tectonica-Dev-Team-Standards-Practices GitHub Wiki
Component Architecture
Overview
This document defines our React component principles for Next.js projects.
Component Design Principles
Core Principles
-
Single Responsibility
- Each component should do one thing well
- Extract complex logic into custom hooks
- Separate concerns (presentation vs logic)
-
Composition Over Inheritance
- Build complex UIs from simple components
- Use component composition patterns
- Avoid deep component hierarchies
-
Reusability
- Design components to be project-agnostic
- Make components configurable via props
- Avoid hard-coded values
-
Predictability
- Components should behave consistently
- Props should be intuitive and well-typed
- Side effects should be clearly managed