Hooks — Use X when Y
| Situation | Use | Why |
|---|---|---|
| Infinite list (page/cursor) | useInfiniteList | Unified pagination shape, simple fetchNextPage |
| Mutations with cache | useMutationEx | Consistent invalidation + error surfacing |
| Shareable filters/sort/page | useUrlState | Typed query params in URL |
| Modals/popovers | useDisclosure | Simple open/close with focus hygiene |
| Search boxes | useDebouncedValue | Prevent chatty queries |
Keep domain hooks thin (e.g., usePostsInfinite) that call lib/actions.
Last updated on