Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

⚛️ React + Typescript Tip: How to create short and easy to remember event types with Typescript ↓

57,738 görüntüleme • 2 yıl önce •via X (Twitter)

10 Yorum

George Moller profil fotoğrafı
George Moller2 yıl önce

I've been working professionally with React for more than 8 years and I compiled all my knowledge into 100+ infographics and 70+ video tutorials just like this one. Check them out ↓

Julius profil fotoğrafı
Julius2 yıl önce

Don't see how this is any easier than react's built-ins..

George Moller profil fotoğrafı
George Moller2 yıl önce

It’s easier to read/maintain because and you have one entry point file in case those types change in react. The only disadvantage of this is that you hide the root type, but that is something I’m willing to accept for the sake of keeping the code “cleaner”.

freddie profil fotoğrafı
freddie2 yıl önce

not good, now you have to keep every member of your team aware of your type aliases for saving some characters. And not every event is the same for every element, you’re not obscuring the fact it's a changeEvent for input, not textarea, or form, or button…

George Moller profil fotoğrafı
George Moller2 yıl önce

ChangeInputEvent, ChangeTextAreaEvent, there you go now...

harpaljadeja.eth (evm/acc) 🇮🇳 profil fotoğrafı
harpaljadeja.eth (evm/acc) 🇮🇳2 yıl önce

Is there a list of all types that are used in React? I always end up looking here and there for different types when I want to combine my custom props object with the html element attributes

Rodwell Leo profil fotoğrafı
Rodwell Leo2 yıl önce

Everyday I learn something new from you. Thank you 🙏

George Moller profil fotoğrafı
George Moller2 yıl önce

Thanks mate! really appreciate the support and happy that you like the content :)

Hassan profil fotoğrafı
Hassan2 yıl önce

👍👍👍

Karl R. profil fotoğrafı
Karl R.2 yıl önce

I do not see a point that would make it easier / cleaner. I totally agree that it makes your component „shorter” though. If I start to work on a new codebase tomorrow, I would not even think that there is a file with such aliases and I would just use built-ins which imo is fine.

Benzer Videolar