正在加载视频...

视频加载失败

⚛️ React + Typescript tip: Creating dynamic prop types for components with Discriminated Unions ↓

77,657 次观看 • 2 年前 •via X (Twitter)

12 条评论

George Moller 的头像
George Moller2 年前

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 ↓

Pavel Romanov 的头像
Pavel Romanov2 年前

One of the best react + typescript tips. It makes the overall code flow so much easier and enforce specific rules whenever needed.

George Moller 的头像
George Moller2 年前

I agree, this is such a common use case for React developers! it's great to have a way to type it.

Web-Dev-Codi 的头像
Web-Dev-Codi2 年前

Typescript version ohhhh yeah. Nice 👍

George Moller 的头像
George Moller2 年前

oh yeah, typescript + react tips are coming my friend!

Shripal Soni 的头像
Shripal Soni2 年前

Loved this tip 🤩

George Moller 的头像
George Moller2 年前

Glad you liked it Shripal!

NORMAL 的头像
NORMAL2 年前

Where’s the discrimination here ? Dang libs 🇺🇸 🍺

freddie 的头像
freddie2 年前

a good idea is to keep all members of the union with the same keys, but set the ones that aren’t supposed to be there as *optional never*. this will help you when writing the body of the component without needing to check for the existence of properties

P4R4NO1D73 的头像
P4R4NO1D732 年前

what tool do you use for animation ?

satonin 的头像
satonin2 年前

Wtf 🥴

Parth Prajapati 的头像
Parth Prajapati2 年前

A super tip! Really cannot imagine working in React + TS without this.

相关视频