Files
CODE_ASSISTANT/2_frontend/docs-lib/tanstack-query.md
T
2026-09-16 17:22:14 +09:00

591 B

TanStack Query v5 참조

출처: https://tanstack.com/query/latest/docs/framework/react/guides/disabling-queries 확인일: 2026-09-11

enabled와 초기 로딩

  • enabled: false이고 캐시가 없으면 status === "pending", fetchStatus === "idle"임.
  • isLoadingisPending && isFetching이라 실제 첫 fetch 중일 때만 참임.
  • 조건이 충족된 뒤 자동 fetch해야 하면 enabled에 조건을 넘김.
const query = useQuery({
  queryKey: ["todos", filter],
  queryFn: () => fetchTodos(filter),
  enabled: Boolean(filter),
})