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

    Function useTrackComments

    • Fetch comments on a SoundCloud track.

      Parameters

      • trackId: string | number | undefined

        The track ID. Pass undefined to skip the request.

      Returns HookResult<SoundCloudComment[]>

      Hook result with data as an array of SoundCloudComment.

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

      function Comments({ trackId }: { trackId: number }) {
      const { data: comments, loading } = useTrackComments(trackId);
      if (loading) return <p>Loading comments...</p>;
      return <ul>{comments?.map(c => <li key={c.id}>{c.body}</li>)}</ul>;
      }