Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Adding form validation to your React app? Try the "reward early, punish late" pattern 🏆

36,764 Aufrufe • vor 2 Jahren •via X (Twitter)

11 Kommentare

Profilbild von Ben Holmes
Ben Holmesvor 2 Jahren

You can codegen this for any app using simple-form!

Profilbild von Ben Holmes
Ben Holmesvor 2 Jahren

Got a full code walkthrough using Astro and Next.js!

Profilbild von Jamon
Jamonvor 2 Jahren

I love these types of subtle UX improvement tips.

Profilbild von Deadlock
Deadlockvor 2 Jahren

These features already available in react-final-form. it's an underdog for form state management as well as light weight package

Profilbild von KEV MOK
KEV MOKvor 2 Jahren

Really top quality video. Have you thought of using Zod with your form validations?

Profilbild von Ben Holmes
Ben Holmesvor 2 Jahren

@LinkedKev Not just *thought* about it. I made a wrapper library 😄

Profilbild von Brian Jordan
Brian Jordanvor 2 Jahren

This has brought me psychic peace, always felt like early early was wrong but not sure why

Profilbild von Tracy Lee | ladyleet
Tracy Lee | ladyleetvor 2 Jahren

Great video, Ben!!!

Profilbild von John Forte
John Fortevor 2 Jahren

Yep, this is why most form packages have isTouched (onBlur) or isDirty (after user modifies field) to allow you to implement things like this.

Profilbild von Magne
Magnevor 2 Jahren

what about checking on input but only after user stops typing? solves both cases I think

Profilbild von Ben Holmes
Ben Holmesvor 2 Jahren

Sounds like validating on a debounce. That's nice sometimes as well! Still, it assumes the user is able to type at a certain speed, and it's hard to dial in an accessible value. Waiting for blur makes certain you validate once the user is done

Ähnliche Videos