Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
form validation in react
Search
yiminghe
March 19, 2015
Technology
4
570
form validation in react
do form validation using react
yiminghe
March 19, 2015
Tweet
Share
More Decks by yiminghe
See All by yiminghe
小程序终端技术架构
yiminghe
0
250
支付宝小程序的开放架构
yiminghe
0
190
gitc2016 react based architecture
yiminghe
1
170
antd at qcon2016
yiminghe
1
240
react-based architecture
yiminghe
2
170
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
320
react best practice
yiminghe
3
220
react at alipay
yiminghe
43
4.5k
Other Decks in Technology
See All in Technology
入社1ヶ月でデータパイプライン講座を作った話
waiwai2111
1
110
KubeCon + CloudNativeCon NA ‘25 Recap, Extensibility: Gateway API / NRI
ladicle
0
150
BPaaSオペレーション・kubell社内 n8n活用による効率化検証事例紹介
kentarofujii
0
310
それぞれのペースでやっていく Bet AI / Bet AI at Your Own Pace
yuyatakeyama
1
660
最速で価値を出すための プロダクトエンジニアのツッコミ術
kaacun
1
330
開発メンバーが語るFindy Conferenceの裏側とこれから
sontixyou
2
320
Agentic Coding 実践ワークショップ
watany
41
27k
ゼロから始めたFindy初のモバイルアプリ開発
grandbig
2
400
AI時代のPMに求められるのは 「Ops」と「Enablement」
shimotaroo
1
350
オープンウェイトのLLMリランカーを契約書で評価する / searchtechjp
sansan_randd
2
310
ドメイン駆動セキュリティへの道しるべ
pandayumi
0
180
AI推進者の視点で見る、Bill OneのAI活用の今
sansantech
PRO
1
200
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.5k
Documentation Writing (for coders)
carmenintech
77
5.2k
[SF Ruby Conf 2025] Rails X
palkan
0
720
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
The Curious Case for Waylosing
cassininazir
0
230
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
87
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
49
Transcript
Form Valida+on In React
[email protected]
form • Tradi+onal way • Library way
• React way – rc-‐form-‐valida+on
Tradi+onal way
Problems • Maintenance – Script and html is separated
– A lot of duplica+on – Hard to reuse code – …
Library way • hFp://jqueryvalida+on.org/documenta+on/
Library way • But you s+ll need to get data
when submit! • hFps://api.jquery.com/serialize/
Problems Customiza/on! Invasion!
In Short
DOM Driven
React Way DATA
Driven
Introduce • rc-‐form-‐valida+on • hFps://github.com/react-‐component/form-‐ valida+on
in general
Step by step -‐1 • Valida+on.FieldMixin – handleValidate – setField
Step by step -‐2 • Declare data model – formData:
field value geFer and seFer – Status: field status (errors,valida+ng…)
Step by step -‐3 • Just render html by data
model and valida+on rules – handleValidate provided by mixins – Declare rules in Validator – Wrap input by Validator and Valida+on
Step by step -‐4 • Validate on submit and get
data – Call validate method – Just get data from data model (two-‐way binding)
Advanced usage • Asynchronous valida+on • Validate custom
component
Asynchronous valida+on • Use validator func+on
Validate custom component • Validate custom component which supports
onChange props, such as rc-‐calendar:
What’s next • Isomorphic Valida+on – hFps://github.com/yiminghe/async-‐validator • rc-‐form-‐valida/on
depends on async-‐validator • async-‐validator can be run at nodejs! Let’s share some valida/on rules!
Try hFp://react-‐component.github.io/form-‐ valida+on/build/examples/form.html