Skip to main content

Overview

Returns a function that fetches the paginated list of users who follow the currently authenticated user. Each entry includes the follow record ID, the follower’s user profile, and the timestamp. For fetching another user’s followers, see useFetchFollowersByUserId.

Usage Example

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

function FollowersList() {
  const fetchFollowers = useFetchFollowers();
  const [followers, setFollowers] = useState([]);

  useEffect(() => {
    fetchFollowers({ page: 1, limit: 20 }).then((res) => {
      setFollowers(res.data);
    });
  }, []);

  return (
    <ul>
      {followers.map(({ followId, user }) => (
        <li key={followId}>{user.name}</li>
      ))}
    </ul>
  );
}

Parameters

The hook returns a function. That function accepts:
page
number
Page number to fetch. Defaults to 1.
limit
number
Number of results per page. Defaults to 20.

Returns

Returns a PaginatedResponse containing an array of follower entries:
data
FollowerWithFollowInfo[]
Array of follower entries.
pagination
object
Pagination metadata including currentPage, totalPages, totalCount, hasNextPage, and hasPreviousPage.