DocsReact HooksuseProfileStats

useProfileStats

The useProfileStats hook fetches and manages the follower and following statistics for a given Ethereum address or ENS name.

Add to your project

import { useProfileStats } from 'ethereum-identity-kit'
 
export default function StatsComponent() {
  const { followers, following, statsLoading, refreshProfileStats } = useProfileStats({
    addressOrName: 'vitalik.eth',
  })
 
  // Create your own loading states
  if (statsLoading) return <div>Loading...</div>
 
  // --- Your component code here ---
}

Parameters

ParameterDescriptionRequiredDefault Value
addressOrNameEthereum Address or ENS name to fetch profile stats for.Yes-
listList number to fetch profile stats for; overrides addressOrName if provided.No-
prefetchedDataPrefetched stats data to use initially.No-
refetchPrefetchedDataFunction to refetch prefetched stats data.No-

Return Values

Return ValueDescription
followersNumber of followers for the profile.
followingNumber of accounts the profile is following.
statsLoadingBoolean indicating if the profile stats are currently loading.
refreshProfileStatsFunction to manually refresh the profile stats.