Skip to main content

Overview

Returns a function that fetches the total follower count of any user, identified by userId. This is a public endpoint — authentication is not required.

Usage Example

import { useFetchFollowersCountByUserId } from "@replyke/react-js";

function UserStats({ userId }: { userId: string }) {
  const fetchFollowersCountByUserId = useFetchFollowersCountByUserId();
  const [count, setCount] = useState<number | null>(null);

  useEffect(() => {
    fetchFollowersCountByUserId({ userId }).then((res) => setCount(res.count));
  }, [userId]);

  return <span>{count ?? "..."} followers</span>;
}

Parameters

The hook returns a function. That function accepts:
userId
string
required
The ID of the user whose follower count to fetch.

Returns

count
number
Total number of followers for the specified user.