soundcloud-api-ts-next
    Preparing search index...

    Function useFollow

    • Follow or unfollow a SoundCloud user. Requires authentication.

      Returns {
          error: Error | null;
          follow: (userId: string | number) => Promise<void>;
          loading: boolean;
          unfollow: (userId: string | number) => Promise<void>;
      }

      An object with follow, unfollow, loading, and error.

      import { useFollow } from "soundcloud-api-ts-next";

      function FollowButton({ userId }: { userId: number }) {
      const { follow, unfollow, loading } = useFollow();
      return (
      <button onClick={() => follow(userId)} disabled={loading}>
      Follow
      </button>
      );
      }