You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`shared/api` 또는 각 slice의 `api` 폴더에서는 **백엔드에서 온 데이터**를 다루고,
148
+
-`entities`에서는 **프론트엔드 관점에서 필요한 데이터 구조**에 집중해야 합니다.
149
+
(예: UI 표시용 데이터, 도메인 로직 처리용 데이터 등)
135
150
:::
136
151
137
152
## API 타입과 클라이언트 자동 생성
138
153
139
-
백엔드에 OpenAPI 스펙이 있다면 [orval](https://orval.dev/)이나 [openapi-typescript](https://openapi-ts.dev/) 같은 도구로 API 타입과 request 함수를 생성할 수 있습니다.
140
-
생성된 코드는 `shared/api/openapi` 등에 두고 `README.md`에 생성 방법과 타입 설명을 문서화하세요.
154
+
백엔드에 OpenAPI 스펙이 준비되어 있다면,
155
+
[orval](https://orval.dev/)이나 [openapi-typescript](https://openapi-ts.dev/) 같은 도구를 사용해
156
+
**API 타입과 request 함수**를 자동으로 생성할 수 있습니다.
157
+
158
+
이렇게 생성된 코드는 보통 `shared/api/openapi` 같은 폴더에 두고,
159
+
`README.md`에 다음 내용을 함께 문서화하는 것을 권장합니다.
160
+
161
+
- 생성 스크립트를 어떻게 실행하는지
162
+
- 어떤 타입/클라이언트가 생성되는지
163
+
- 사용하는 방법 예시
141
164
142
165
## 서버 상태 라이브러리 연동
143
166
144
-
[TanStack Query (React Query)](https://tanstack.com/query/latest)나 [Pinia Colada](https://pinia-colada.esm.dev/) 같은 서버 상태 관리 라이브러리를 사용할 때는 slice 간 타입이나 cache key를 공유해야 할 수 있습니다.
145
-
이럴 때는 `shared` layer에 다음을 배치하세요.
167
+
[TanStack Query (React Query)](https://tanstack.com/query/latest)나 [Pinia Colada](https://pinia-colada.esm.dev/) 같은 **서버 상태 관리 라이브러리**를 사용할 때는,
168
+
서로 다른 slice에서 **타입이나 cache key를 공유**해야 할 때가 자주 생깁니다.
169
+
170
+
이런 경우에는 다음과 같은 항목들을 `shared` layer에 두고 같이 쓰는 것이 좋습니다.
146
171
147
-
- API 데이터 타입 (API data types)
148
-
- 캐시 키 (cache keys)
149
-
- 공통 query/mutation 옵션 (common query/mutation options)
172
+
- API 데이터 타입 (API data types)
173
+
- 캐시 키 (cache keys)
174
+
- 공통 query/mutation 옵션 (common query/mutation options)
0 commit comments