Skip to content

Commit 06ca943

Browse files
committed
docs(readme): add working in typescript example
1 parent 6f10781 commit 06ca943

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,20 @@ const ref = useRef();
528528
const { playState } = useWebAnimations({ ref });
529529
```
530530

531+
## Working in TypeScript
532+
533+
This hook supports [TypeScript](https://www.typescriptlang.org), you can tell the hook what type of element you are going to animate through the [generic type](https://www.typescriptlang.org/docs/handbook/generics.html):
534+
535+
```ts
536+
const App = () => {
537+
const { ref } = useWebAnimations<HTMLDivElement>();
538+
539+
return <div ref={ref} />;
540+
};
541+
```
542+
543+
> 💡 For more available types, please [check it out](src/use-web-animations.d.ts).
544+
531545
## API
532546

533547
```js

0 commit comments

Comments
 (0)