Skip to main content

Overview

Returns a function that fetches the total number of accepted connections for any user, identified by userId. This is a public endpoint — authentication is not required.

Usage Example

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

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

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

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

Parameters

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

Returns

count
number
Total number of accepted connections for the specified user.