Skip to main content

useFetchFollowingCountByUserId

Overview

The useFetchFollowingCountByUserId hook fetches the total number of users that a specific user is following. This is a public endpoint that allows you to retrieve following counts for any user without authentication.

Usage Example

Advanced Usage with State

Parameters & Returns

Parameters

The hook returns a function that accepts an object with the following field:
userId
string
required
The ID of the user whose following count to fetch

Returns

The function returns a Promise that resolves to an object containing:
count
number
The total number of users this user is following

Error Handling

The hook will throw errors in the following cases:
  • No user ID is provided
  • No project is specified

Notes

This is a public endpoint that doesn’t require user authentication, making it suitable for displaying any user’s following count in public-facing features like user profiles or discovery pages.