Skip to main content

refetchAfterHydrate

Description: Reexecute the action after the component has been hydrated.

Default Value: true.

  • How To: Use refetchAfterHydrate: true when you want to ensure the data is always fresh after hydration, even if it was pre-fetched on the server. This can be particularly useful for highly dynamic content where the server-rendered data might already be slightly outdated by the time the client hydrates.
    // Correct: Ensure latest news feed after hydration
    useFetch(
    'news-feed',
    fetchNewsFeed,
    { refetchAfterHydrate: true }
    );
  • Best Practice: Avoid refetchAfterHydrate: true for static or less critical data to reduce client-side refetches immediately after page load, which can impact perceived performance.