Skip to main content

Overview

Returns a function that follows a target user. The current user must be authenticated. Use useFollowManager if you need status tracking and toggle behavior; use this hook directly when you need fine-grained control.

Usage Example

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

function FollowButton({ userId }: { userId: string }) {
  const followUser = useFollowUser();

  const handleFollow = async () => {
    await followUser({ userId });
  };

  return <button onClick={handleFollow}>Follow</button>;
}

Parameters

The hook returns a function. That function accepts:
userId
string
required
The ID of the user to follow.

Returns

The function returns Promise<void>.