[내용 공유를 위한 PR] queryKey 관리를 위한 queryOption 객체 정의 #160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 개요
queryKey 관리를 위한 queryOption 객체 정의
🎯 목적
queryKey가 관리되지 않아, API 스펙 변경 시 useQuery에는 변경, invalidateQuery에서는 변경하지 않는 실수가 있었습니다.
이를 방지하기 위한 queryOption 객체를 정의해 보았습니다.
참고사항
어떤 방식을 도입할지 고민한 내용을 아래에 정리했으니 참고하시면 좋을 것 같습니다!
https://plume-forest-69a.notion.site/QueryKey-23505cf56f5680169a1ae9bae8a2c68b?source=copy_link
💬 논의 사항 (선택)
지금 방식은 사용 시 아래와 같은 형태로 사용해야 하는데 너무 복잡한가요?
1, 2번 방법 중 어떤 방법이 나은지 알려주세요~