The track ID. Pass undefined to skip the request.
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>;
}
Fetch comments on a SoundCloud track.