Skip to Content
FrontendHooksWhen to use what

Hooks — Use X when Y

SituationUseWhy
Infinite list (page/cursor)useInfiniteListUnified pagination shape, simple fetchNextPage
Mutations with cacheuseMutationExConsistent invalidation + error surfacing
Shareable filters/sort/pageuseUrlStateTyped query params in URL
Modals/popoversuseDisclosureSimple open/close with focus hygiene
Search boxesuseDebouncedValuePrevent chatty queries

Keep domain hooks thin (e.g., usePostsInfinite) that call lib/actions.

Last updated on