Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

❌ Avoid deeply nested validations that are hard to read. ✅ Instead use invariants.

206,841 görüntüleme • 1 yıl önce •via X (Twitter)

10 Yorum

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

I've been working professionally with React and JavaScript 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 ↓

PATRYK profil fotoğrafı
PATRYK1 yıl önce

Don’t follow this advice. It makes your code less readable, it confuses other developers and your IDE. This level of abstraction is not helping anybody. Just use early return.

Vlad Tansky profil fotoğrafı
Vlad Tansky1 yıl önce

Nice, but wouldn’t it be easier to read code with if(!condition) throw new Error(“some message”) Instead of creating abstraction?

xavi profil fotoğrafı
xavi1 yıl önce

Just use fail fast/ early return and you’ll avoid that level of abstraction.

dcodes 🦀 profil fotoğrafı
dcodes 🦀1 yıl önce

just use zod

Hamilton Greene 🐷🦔 profil fotoğrafı
Hamilton Greene 🐷🦔1 yıl önce

I don't like this - you're hiding important control flow inside deeply nested functions. The caller must now know that implicitly your functions use exception control flow and throw on certain conditions (also hidden). Guards (if not x return) are usually better.

Remus profil fotoğrafı
Remus1 yıl önce

Dude an "any" wrapper function? That's scares the shit out of me

Proziam profil fotoğrafı
Proziam1 yıl önce

I have to know, what are you using for the animations and graphics? Looks clean

Ndeye Fatou Diop 🚢 💻 | DEV | 🇸🇳🇫🇷 profil fotoğrafı
Ndeye Fatou Diop 🚢 💻 | DEV | 🇸🇳🇫🇷1 yıl önce

💯 This makes it super hard to read the code

Seve profil fotoğrafı
Seve1 yıl önce

"early bail" or "early return" is far better terminology

Benzer Videolar