The SoundCloud track ID. Pass undefined to skip the request.
Hook result with data as a SoundCloudTrack, plus loading and error states.
import { useTrack } from "soundcloud-api-ts-next";
function TrackInfo({ id }: { id: number }) {
const { data: track, loading, error } = useTrack(id);
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
return <h1>{track?.title}</h1>;
}
Fetch a single SoundCloud track by ID.