mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
docs: ✏️ improve useAudio docs
This commit is contained in:
parent
4336aa1ab1
commit
09526582ce
@ -46,7 +46,7 @@
|
||||
<br/>
|
||||
<br/>
|
||||
- [__UI__](./docs/UI.md)
|
||||
- [`useAudio`](./docs/useAudio.md) — plays audio and exposes controls.
|
||||
- [`useAudio`](./docs/useAudio.md) — plays audio and exposes its controls.
|
||||
<br/>
|
||||
<br/>
|
||||
- [__Animations__](./docs/Animations.md)
|
||||
|
||||
@ -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` — all props that `<audio>` accepts.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user