Skip to main content

Overview

Returns a function that fetches the total count of users that a given user follows. This is a public endpoint — authentication is not required.

Usage Example

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

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

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

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

Parameters

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

Returns

count
number
Total number of users that the specified user is following.