Skip to main content

Overview

Returns a function that checks whether the current authenticated user follows a given userId. Returns a status object including the follow ID and timestamp if following.

Usage Example

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

function ProfilePage({ userId }: { userId: string }) {
  const fetchFollowStatus = useFetchFollowStatus();

  useEffect(() => {
    fetchFollowStatus({ userId }).then((status) => {
      console.log(status.isFollowing, status.followId);
    });
  }, [userId]);
}

Parameters

The hook returns a function. That function accepts:
userId
string
required
The ID of the user to check. Cannot be the current user’s own ID.

Returns

isFollowing
boolean
Whether the current user is following the target user.
followId
string | undefined
The ID of the follow record. Present when isFollowing is true.
followedAt
string | undefined
ISO timestamp of when the follow was created. Present when isFollowing is true.