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
580
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
form validation in react
do form validation using react
yiminghe
March 19, 2015
More Decks by yiminghe
See All by yiminghe
小程序终端技术架构
yiminghe
0
300
支付宝小程序的开放架构
yiminghe
0
230
gitc2016 react based architecture
yiminghe
1
190
antd at qcon2016
yiminghe
1
250
react-based architecture
yiminghe
2
190
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
350
react best practice
yiminghe
3
230
react at alipay
yiminghe
43
4.6k
Other Decks in Technology
See All in Technology
SO-101×VLAによる3色キューブのピック&プレース
abeja
0
200
ガバメント AI 源内を地方自治体は活用できるのか可能性と課題、期待について
takeda_h
1
410
猫付きpingコマンドを自作
uyuki234
0
240
制約理論(ToC)入門 2026版
recruitengineers
PRO
8
2.3k
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
130
Bits Agent Builder の⼊⾨と活⽤事例
nulabinc
PRO
0
140
20分でわかるセキュアAPI
nwiizo
2
280
Kiro Crew入門 - 常駐エージェントの仕組みと使いどころ / Intro to Kiro Crew
k_adachi_01
1
120
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
1
270
今こそ聞きたいソフトウェア設計 ドメイン駆動設計再入門
masuda220
PRO
17
7.3k
AWS ネットワーク構築でハマった(ハマりかけた) 5選とそこから得た教訓
nagisa53
4
220
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
750
Featured
See All Featured
Bash Introduction
62gerente
615
220k
How to Ace a Technical Interview
jacobian
281
24k
sira's awesome portfolio website redesign presentation
elsirapls
0
320
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
490
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
Automating Front-end Workflow
addyosmani
1369
210k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
770
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
The Pragmatic Product Professional
lauravandoore
37
7.4k
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