Skip to main content

Overview

Returns a function that fetches the paginated list of users the currently authenticated user follows. Each entry includes the follow record ID, the followed user’s profile, and the timestamp. For fetching another user’s following list, see useFetchFollowingByUserId.

Usage Example

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

function FollowingList() {
  const fetchFollowing = useFetchFollowing();
  const [following, setFollowing] = useState([]);

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

  return (
    <ul>
      {following.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 following entries:
data
FollowingWithFollowInfo[]
Array of following entries.
pagination
object
Pagination metadata including currentPage, totalPages, totalCount, hasNextPage, and hasPreviousPage.