Skip to content

[7팀 제정원] Chapter 2-3. 관심사 분리와 폴더구조#66

Open
jejemerong wants to merge 18 commits intohanghae-plus:mainfrom
jejemerong:main
Open

[7팀 제정원] Chapter 2-3. 관심사 분리와 폴더구조#66
jejemerong wants to merge 18 commits intohanghae-plus:mainfrom
jejemerong:main

Conversation

@jejemerong
Copy link

과제 체크포인트

기본과제

목표 : 전역상태관리를 이용한 적절한 분리와 계층에 대한 이해를 통한 FSD 폴더 구조 적용하기

  • 전역상태관리를 사용해서 상태를 분리하고 관리하는 방법에 대한 이해
  • Context API, Jotai, Zustand 등 상태관리 라이브러리 사용하기
  • FSD(Feature-Sliced Design)에 대한 이해
  • FSD를 통한 관심사의 분리에 대한 이해
  • 단일책임과 역할이란 무엇인가?
  • 관심사를 하나만 가지고 있는가?
  • 어디에 무엇을 넣어야 하는가?

체크포인트

  • 전역상태관리를 사용해서 상태를 분리하고 관리했나요?
  • Props Drilling을 최소화했나요?
  • shared 공통 컴포넌트를 분리했나요?
  • shared 공통 로직을 분리했나요?
  • entities를 중심으로 type을 정의하고 model을 분리했나요?
  • entities를 중심으로 ui를 분리했나요?
  • entities를 중심으로 api를 분리했나요?
  • feature를 중심으로 사용자행동(이벤트 처리)를 분리했나요?
  • feature를 중심으로 ui를 분리했나요?
  • feature를 중심으로 api를 분리했나요?
  • widget을 중심으로 데이터를 재사용가능한 형태로 분리했나요?

심화과제

목표: 서버상태관리 도구인 TanstackQuery를 이용하여 비동기코드를 선언적인 함수형 프로그래밍으로 작성하기

  • TanstackQuery의 사용법에 대한 이해
  • TanstackQuery를 이용한 비동기 코드 작성에 대한 이해
  • 비동기 코드를 선언적인 함수형 프로그래밍으로 작성하는 방법에 대한 이해

체크포인트

  • 모든 API 호출이 TanStack Query의 useQuery와 useMutation으로 대체되었는가?
  • 쿼리 키가 적절히 설정되었는가?
  • fetch와 useState가 아닌 선언적인 함수형 프로그래밍이 적절히 적용되었는가?
  • 캐싱과 리프레시 전략이 올바르게 구현되었는가?

과제 셀프회고

과제에서 좋았던 부분

과제를 하면서 새롭게 알게된 점

과제를 진행하면서 아직 애매하게 잘 모르겠다 하는 점, 혹은 뭔가 잘 안되서 아쉬운 것들

리뷰 받고 싶은 내용이나 궁금한 것에 대한 질문

Copy link

@suinkimme suinkimme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정원님은 feature에 기능을 작명할 때 스네이크 케이스로를 사용하셨네요! 저도 어떻게할까 한참 고민했던 부분인데 생각보다 보기 좋네요!

@@ -0,0 +1,10 @@
import { Post } from "@/entities/posts/model/post.type"

export const addPost = async (newPost: Pick<Post, "title" | "body" | "userId">) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pick이라는 기능이 있군요.. TypeScript를 잘 몰라서 이런 기능 있었으면 했는데..

return useQuery<PostsResponse>({
queryKey: ["posts", searchQuery],
queryFn: () => getSearchQueryPosts(searchQuery),
enabled: !!searchQuery,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오! 저랑 구현 방법이 똑같으시네요! TanStack Query에 익숙하지 않아서... 올바른 방법인지 몰랐습니다.

className?: string
}

export const Modal = ({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 Modal 자체를 컴포넌트로 분리할 수 있었네요...! 저는 이런 디테일 챙겨지 못했습니다...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그러게요!! 저도 모달 분리 생각만 한......

Comment on lines +16 to +24
<SelectContainer
value={limit.toString()}
onValueChange={(value) => onLimitChange(Number(value))}
placeholder="10"
>
<SelectItem value="10">10</SelectItem>
<SelectItem value="20">20</SelectItem>
<SelectItem value="30">30</SelectItem>
</SelectContainer>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 shared에 Paignation 컴포넌트를 위치 시켰는데 성식님 코드를 보니 게시글 몇개까지 위치 시킬껀지는 결정하는 UI상태 로직은 사용부에서 분리시키는게 좋을것 같더라구요 ㅠㅠ

Copy link

@jinsoul75 jinsoul75 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FSD 저만 이해를 못한거같아여 ㅠㅠ 정원님도 레이어에 맞게 분리를 잘 해주셧네용 !! 이번주도 고생많으셨어요 !! TDD도 뿌셔봅시댜!!!!!

Copy link

@keyonnaise keyonnaise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정원님, 이번 과제는 난이도도 어렵고 api도 시원치않아 어려움이 있었을 텐데도 포기하지 않고 끝까지 완수하시는 모습을 보면서 저 또한 마음을 다잡게 되었습니다. 테스트 코드 챕터도 함께 힘내서 잘 헤쳐나가기를 바랍니다!


export const usePostsQuery = () => {
return useQuery<PostsResponse>({
queryKey: ["posts"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TanStack Query를 사용하면서 쿼리 키 관리가 번거롭게 느껴질 때가 있는데, 이 문제를 좀 더 쉽게 해결할 수 있도록 도와주는 query-key-factory 라이브러리가 있다고 합니다! TanStack Query에 관심이 있으시면 같이 살펴보시면 좋을 것 같아요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants