---
id: wiki-2026-0508-프론트엔드-컴포넌트-구조화
title: 프론트엔드 컴포넌트 구조화
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Frontend Component Structure, Component Organization]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [frontend, react, architecture, component-design]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: typescript
framework: react-19/next-15
---
# 프론트엔드 컴포넌트 구조화
## 매 한 줄
> **"매 component 의 size, scope, composition 의 systematic decomposition"**. 매 atomic design (atom→molecule→organism), feature-based (colocation), compound component, headless UI 의 4-axis. 매 2026 의 default — feature-folder + headless primitives (Radix/Ark) + Server Components.
## 매 핵심
### 매 4 가지 axis
1. **Size**: atom · molecule · organism · template · page (Atomic Design).
2. **Scope**: feature-local vs shared / design system.
3. **Composition**: leaf vs container vs compound vs headless.
4. **Boundary**: Server Component vs Client Component (RSC).
### 매 file/folder strategy
- **Co-location**: `components/Button/{index.tsx, Button.css, Button.test.tsx, Button.stories.tsx}`.
- **Feature folder**: `features/checkout/{components, hooks, api, types}` — feature 의 self-contained.
- **Shared design system**: `packages/ui` — monorepo + workspace.
### 매 응용
1. Component library / design system 구축.
2. Large app 의 modular feature decomposition.
3. Server Components 의 server/client boundary 결정.
## 💻 패턴
### 1. Atomic Design folder
```
src/components/
atoms/ Button, Input, Icon
molecules/ SearchBar, FormField
organisms/ Header, ProductCard
templates/ CheckoutLayout
```
### 2. Feature-based folder (recommended 2026)
```
src/features/checkout/
components/CheckoutForm.tsx
hooks/useCheckout.ts
api/createOrder.ts
schemas/order.ts
index.ts // public API
```
### 3. Compound component
```tsx
function Tabs({ children, defaultValue }: Props) {
const [value, setValue] = useState(defaultValue);
return {children};
}
Tabs.List = TabsList;
Tabs.Trigger = TabsTrigger;
Tabs.Content = TabsContent;
// Usage:
A
...
```
### 4. Headless component (Radix-style)
```tsx
function useDisclosure() {
const [open, setOpen] = useState(false);
return { open, toggle: () => setOpen(o => !o), close: () => setOpen(false) };
}
// Consumer styles freely
function MyDialog() {
const d = useDisclosure();
return
{d.open && '...'}
;
}
```
### 5. Server / Client boundary (Next.js 15)
```tsx
// app/products/page.tsx (Server Component — default)
import { ProductList } from './ProductList';
import { db } from '@/db';
export default async function Page() {
const products = await db.product.findMany();
return ;
}
// app/products/AddToCart.tsx
'use client';
export function AddToCart({ id }: { id: string }) {
return ;
}
```
### 6. Polymorphic component (`as` prop)
```tsx
type BoxProps = {
as?: T;
} & React.ComponentPropsWithoutRef;
function Box({ as, ...rest }: BoxProps) {
const Tag = as || 'div';
return ;
}
link;
```
### 7. Container / Presentational split (when useful)
```tsx
// Container — data + logic
function UserListContainer() {
const { data } = useUsers();
return ;
}
// Presentational — pure UI
function UserListView({ users }: { users: User[] }) {
return {users.map(u => - {u.name}
)}
;
}
```
### 8. Public API barrel (`index.ts`)
```typescript
// features/checkout/index.ts
export { CheckoutForm } from './components/CheckoutForm';
export { useCheckout } from './hooks/useCheckout';
export type { Order } from './schemas/order';
// 매 internal 은 export X — encapsulation.
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Design system | Atomic + headless (Radix/Ark) |
| Product feature | Feature folder + co-location |
| Multi-trigger UI (Tabs, Menu) | Compound component |
| Style flexibility | Headless + custom CSS |
| Next.js 15 app | Server-default, Client only when needed |
| Reusable variant via tag | Polymorphic `as` |
**기본값**: 매 feature folder + 매 headless primitives (Radix/Ark) + 매 Server Components default.
## 🔗 Graph
- 부모: [[Component-Composition|Component-Based Architecture]] · [[Large_Frontend_Projects|Frontend Architecture]]
- 변형: [[Atomic Design]] · [[Component-Composition|Compound Components]] · [[Headless UI]] · [[Modern_Web_Rendering_and_Optimization|Server Components]]
- 응용: [[Design System]] · [[Monorepo]]
- Adjacent: [[Custom Hooks]] · [[Render_Props|Render Props]]
## 🤖 LLM 활용
**언제**: 매 large app 의 component decomposition 결정 시. 매 server/client boundary planning 시.
**언제 X**: 매 prototype / single-page demo — 매 over-structuring 의 X.
## ❌ 안티패턴
- **God component**: 매 1000-line component — 매 split.
- **Atomic Design 의 dogmatic 적용**: 매 feature 에는 feature folder 가 더 적합.
- **'use client' 남발**: 매 root 에 client 선언 — 매 RSC benefit 상실.
- **Container/Presentational 강요**: 매 hooks 시대에는 obsolete pattern.
- **Barrel re-export 의 deep nesting**: 매 bundler tree-shaking 방해.
## 🧪 검증 / 중복
- Verified (React docs, Next.js 15 docs, Radix UI / Ark UI patterns).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 4-axis decomposition + 8 patterns + RSC boundary |