docs: ✏️ improve useAudio docs

This commit is contained in:
streamich 2018-10-28 10:29:26 +01:00
parent 4336aa1ab1
commit 09526582ce
2 changed files with 7 additions and 4 deletions

View File

@ -46,7 +46,7 @@
<br/>
<br/>
- [__UI__](./docs/UI.md)
- [`useAudio`](./docs/useAudio.md) &mdash; plays audio and exposes controls.
- [`useAudio`](./docs/useAudio.md) &mdash; plays audio and exposes its controls.
<br/>
<br/>
- [__Animations__](./docs/Animations.md)

View File

@ -45,13 +45,13 @@ const [audio, state, controls, ref] = useAudio(props);
```
`audio` is React's `<audio>` element that you have to insert somewhere in your
render tree, for example
render tree, for example:
```jsx
<div>{audio}</div>
```
`state` represents the state of the audio and the the following shape
`state` tracks the state of the audio and has the following shape:
```json
{
@ -70,7 +70,7 @@ render tree, for example
```
`controls` is a list collection of methods that allow you to control the
playback of the audio, it has the following interface
playback of the audio, it has the following interface:
```ts
interface AudioControls {
@ -83,4 +83,7 @@ interface AudioControls {
}
```
`ref` is a React reference to HTML `<audio>` element, you can access the element by
`ref.current`, note that it may be `null`.
And finally, `props` &mdash; all props that `<audio>` accepts.