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

    Function useUserTracks

    • Fetch tracks uploaded by a SoundCloud user.

      Parameters

      • userId: string | number | undefined

        The user ID. Pass undefined to skip the request.

      Returns HookResult<SoundCloudTrack[]>

      Hook result with data as an array of SoundCloudTrack.

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

      function Tracks({ userId }: { userId: number }) {
      const { data: tracks, loading } = useUserTracks(userId);
      if (loading) return <p>Loading...</p>;
      return <ul>{tracks?.map(t => <li key={t.id}>{t.title}</li>)}</ul>;
      }