Skip to content

🎸 React Hook to use realtime last.fm data and display your currently played song in your application.

License

Notifications You must be signed in to change notification settings

songish/use-last-fm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

use-last-fm

CI Status

Stream your currently playing song through last.fm as a React hook.

Features

  • 📦 Tiny: use-last-fm weighs in at less than 700 bytes minified and gzipped.
  • 🌳 Universal: we dist esm and cjs modules.
  • 👨‍💻 Developer friendly: Helpful development messages that are stripped away in production
  • ⌨️ Strongly typed: use-last-fm is written in TypeScript and encourages good practices this way

Installation

With NPM

npm i --save use-last-fm

Or, with yarn:

yarn add use-last-fm

Usage

import { useLastFM } from 'use-last-fm';

const CurrentlyPlaying = () => {
  const lastFM = useLastFM('aabbccsmith', '[add api token here]');

  if (lastFM.status !== 'playing') {
    return <p>Not listening to anything</p>;
  }

  return (
    <p>
      Listening to {lastFM.song.name} by {lastFM.song.artist}
    </p>
  );
};

A full example can be seen in the examples folder

About

🎸 React Hook to use realtime last.fm data and display your currently played song in your application.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.4%
  • HTML 6.6%