Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/alii/use-last-fm

🎸 React Hook to use realtime last.fm data and display your currently played song in your application.
https://github.com/alii/use-last-fm

last-fm lastfm music react react-dom react-hook react-music react-music-hook spotify use-hook

Last synced: 3 months ago
JSON representation

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

Lists

README

        

![use-last-fm](docs/use-last-fm.jpg)

![CI Status](https://github.com/webmail/use-last-fm/workflows/CI/badge.svg)

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

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

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

if (lastFM.status !== 'playing') {
return

Not listening to anything

;
}

return (


Listening to {lastFM.song.name} by {lastFM.song.artist}


);
};
```

A full example can be seen in the [examples](https://github.com/webmail/use-last-fm/tree/master/example) folder