正在加载视频...

视频加载失败

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

36,764 次观看 • 2 年前 •via X (Twitter)

11 条评论

Ben Holmes 的头像
Ben Holmes2 年前

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

Ben Holmes 的头像
Ben Holmes2 年前

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

Jamon 的头像
Jamon2 年前

I love these types of subtle UX improvement tips.

Deadlock 的头像
Deadlock2 年前

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

KEV MOK 的头像
KEV MOK2 年前

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

Ben Holmes 的头像
Ben Holmes2 年前

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

Brian Jordan 的头像
Brian Jordan2 年前

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

Tracy Lee | ladyleet 的头像
Tracy Lee | ladyleet2 年前

Great video, Ben!!!

John Forte 的头像
John Forte2 年前

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

Magne 的头像
Magne2 年前

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

Ben Holmes 的头像
Ben Holmes2 年前

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

相关视频