Chok’s React Utilities
    Preparing search index...

    Function sharedQuery

    • Create a reusable shared query object that can be used to auto de-duplicate and cache all data fetches, with auto-expiration and staleness checks.

      Each queryName must be unique, and can only be declared once, most often in the top level scope. The queryName is used for logging only.

      Example:

        export const usersQuery = sharedQuery({
      queryName: "users",
      queryFn: listUsers,
      persistTo: "indexedDb",
      staleMs: MS_PER_DAY,
      });

      Type Parameters

      • TArgs extends unknown[]
      • TData

      Parameters

      Returns SharedQuery<TArgs, TData>