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

    Function useTrack

    • Fetch a single SoundCloud track by ID.

      Parameters

      • trackId: string | number | undefined

        The SoundCloud track ID. Pass undefined to skip the request.

      Returns HookResult<SoundCloudTrack>

      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>;
      }