🎸 React Hook to use realtime last.fm data and display your currently played song in your application.
MIT License
Stream your currently playing song through last.fm as a React hook.
use-last-fm
weighs in at less than 700 bytes minified and gzipped.use-last-fm
is written in TypeScript and encourages good practices this way
npm i --save use-last-fm
yarn add use-last-fm
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