Skip to main content

Overview

Returns a function that unfollows a target user by their user ID. The current user must be authenticated. This is the simpler alternative to useUnfollowByFollowId when you don’t have the follow record ID.

Usage Example

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

function UnfollowButton({ userId }: { userId: string }) {
  const unfollowUserByUserId = useUnfollowUserByUserId();

  return (
    <button onClick={() => unfollowUserByUserId({ userId })}>
      Unfollow
    </button>
  );
}

Parameters

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

Returns

The function returns Promise<void>.