Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

❌ You 𝗺𝗶𝗴𝗵𝘁 not need a react form library ✅ Instead you can use the FormData API's

81,577 Aufrufe • vor 3 Jahren •via X (Twitter)

11 Kommentare

Profilbild von George Moller
George Mollervor 3 Jahren

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

Profilbild von George Moller
George Mollervor 3 Jahren

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

Profilbild von Gaurav Pandey
Gaurav Pandeyvor 3 Jahren

**might** is the catch😅

Profilbild von George Moller
George Mollervor 3 Jahren

☝️ exactly

Profilbild von Ayush Raj ⚡
Ayush Raj ⚡vor 3 Jahren

Can I do validation of a particular field based on some other field without using useEffect ?

Profilbild von George Moller
George Mollervor 3 Jahren

You can do that with Zod yes an refine (superRefine) SomeSchema.superRefine(({ confirmPassword, password }, ctx) => { if (confirmPassword !== password) { ctx.addIssue({ code: "custom", message: "The passwords did not match" }); } });

Profilbild von Darth Sidious
Darth Sidiousvor 3 Jahren

"You might not need a react form library. You just need to install zod instead"

Profilbild von George Moller
George Mollervor 3 Jahren

you should use zod with react-hook-form too :)

Profilbild von Mohamed Ramadan
Mohamed Ramadanvor 3 Jahren

Please be clear about "might not" because you "might not" need zod as well 😅 FormData can be used for a very simple projects, however for big scale products react-hook-form is the hero. It provide fully typescript support and also validation for object and arrays 💪

Profilbild von Molly Boyle
Molly Boylevor 3 Jahren

I'm a heavy user and fan of react-hook-form. But I didn't realize all the native capabilities of FormData and form elements. Might reach for this first for simpler forms.

Profilbild von George Moller
George Mollervor 3 Jahren

Yes I think for simpler forms using the native api makes sense. Also, I love exploring native web APIs, that's what actually drove me to write this tweet 😅. I'm a heavy user and fan of react-hook-form as well, I used formik before and really like the API that rhf offers.

Ähnliche Videos