Loading video...

Video Failed to Load

Go Home

⚛️ How to use discriminated unions in TypeScript to represent mutually exclusive states in React↓

28,192 views • 1 year ago •via X (Twitter)

9 Comments

George Moller's profile picture
George Moller1 year ago

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

Ndeye Fatou Diop 🚢 💻 | DEV | 🇸🇳🇫🇷's profile picture
Ndeye Fatou Diop 🚢 💻 | DEV | 🇸🇳🇫🇷1 year ago

This is the best way to represent loading data and the one I use. Unfortunately I often see this representation type Response<T, E> = { isPending: Boolean, error: T | null, data: T} which can represent invalid states

George Moller's profile picture
George Moller1 year ago

Glad you liked it :)

David K 🎹's profile picture
David K 🎹1 year ago

This is nice!

Daan's profile picture
Daan1 year ago

Really like your new video style! Can you point out a good Typescript course?

Wk - Kevin's profile picture
Wk - Kevin1 year ago

I have another one, its called “react-query”

kmylo's profile picture
kmylo1 year ago

shouldn't be better an enum or even better an obj as const? instead of work with literal strings?

Youry's profile picture
Youry1 year ago

@_georgemoller thanks for sharing it! Just wondering what tool do you use to record the videos? They are really good 👍

Casey Key's profile picture
Casey Key1 year ago

How did your create this animation?

Related Videos