Strong typing useRef : React + TypeScript

preview_player
Показать описание
TypeScript and React sometimes need a helping hand so they can play ball well together. Let‘s check how to use `Ref` and forward our `Ref` onto different components to interact imperatively with the DOM. We will do that while creating a nice and accessible Audio Player 🎸

📽 Chapters

0:34 Ref: what is it? What is it used for? 🧐
2:04 Get started with the Player component 🎧
3:54 Typing the Player component 🔒
4:42 Controls component 🕹
6:35 Add types to the Control component 🔒
8:24 Create a Ref with useRef() hook 🪝
9:19 Add audio source 🎶
10:10 Everything working!! 🚀
Рекомендации по теме
Комментарии
Автор

You really explained this in a perfect and concise way, exactly what I was looking for! Thanks!

alexwallden
Автор

Thanks so much Atila. Very nice explanation of useRef in such a short video.

Shakeel
Автор

Amazing video. You're strong. What do you think of my typing on TypeRacer?

blast
Автор

Thanks for the video! For your <Controls /> component, is there any difference if we pass "audioPlayer" as a "ref" instead of a prop i.e., <Controls ref={audioPlayer}></Controls>

edmundchan
Автор

Atila, what the font family you're using in your vscode?

thanhtohieu
welcome to shbcf.ru