Initial Commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# TanStack Query v5 참조
|
||||
|
||||
출처: https://tanstack.com/query/latest/docs/framework/react/guides/disabling-queries
|
||||
확인일: 2026-09-11
|
||||
|
||||
## enabled와 초기 로딩
|
||||
|
||||
- `enabled: false`이고 캐시가 없으면 `status === "pending"`, `fetchStatus === "idle"`임.
|
||||
- `isLoading`은 `isPending && isFetching`이라 실제 첫 fetch 중일 때만 참임.
|
||||
- 조건이 충족된 뒤 자동 fetch해야 하면 `enabled`에 조건을 넘김.
|
||||
|
||||
```tsx
|
||||
const query = useQuery({
|
||||
queryKey: ["todos", filter],
|
||||
queryFn: () => fetchTodos(filter),
|
||||
enabled: Boolean(filter),
|
||||
})
|
||||
```
|
||||
Reference in New Issue
Block a user