use-howler
v1.0.0
Published
Howler React hook
Downloads
3
Readme
Howler react hook (useHowler)
Please refer to Howler documentation for more details.
Install
npm install --save use-howler
Usage
import React, { useState } from 'react'
import useHowler from 'use-howler'
function App() {
const sound = useHowler({ src: './sample.wav' })
const [playingId, setPlayingId] = useState<number | undefined>()
return (
<div>
<button onClick={() => setPlayingId(sound.togglePlay(playingId))}>
{playingId ? 'Stop' : 'Play'}
</button>
</div>
)
}