react query enabled false 일 때, isLoading true 하는 오류

GJ·2023년 6월 2일
0

문제 인식

react query 사용 중에 enabled: false 처리하는 경우가 있는데 이러면 isLoading이 true를 반환한다.
아직 쿼리가 시작되지 않았는데 isLoading이 true가 되는 것이다.

해결 방법

아직 이 부분에 대한 해결은 없지만, react-query v4에서 isInitialLoading이라는 새로운 인자를 반환해주므로 v4이상부터는 이것을 사용하면 된다.

참조

https://github.com/TanStack/query/issues/3584

profile
Frontend Developer

0개의 댓글