Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
330
支付宝小程序的开放架构
yiminghe
0
260
gitc2016 react based architecture
yiminghe
1
190
antd at qcon2016
yiminghe
1
260
react-based architecture
yiminghe
2
200
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
360
react best practice
yiminghe
3
250
react at alipay
yiminghe
43
4.6k
Other Decks in Technology
See All in Technology
データエンジニアの次の戦場は "プロセスエンジニアリング"
sansantech
PRO
1
120
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
320
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
310
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
4
630
JAWSUG TOHOKU 青森支部 「LoGoチャット」のAWS移行で 乗り越えたこと
taketakekaho
0
350
触りたくないデータに、どう触るか AI時代のRBACアクセスガバナンス
ivry_presentationmaterials
0
290
PHPカンファレンス関西の招待状 / Invitation to PHP Conference Kansai
ykanoh
0
220
freeeにおけるSoftware Factory
freee
PRO
0
110
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
160
エンタメ企業のM&Aを支えるデータ基盤 ― 統合から店舗のリアルタイム分析まで / Data Engineering Summit 2026
genda
0
210
大型犬好きによるPugの紹介
yamanoku
1
160
Kiro Crewで「みのるん式」仕事術やってみた
minorun365
PRO
3
910
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
55
10k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
810
Chasing Engaging Ingredients in Design
codingconduct
0
370
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Between Models and Reality
mayunak
4
500
The browser strikes back
jonoalderson
0
1.8k
エンジニアに許された特別な時間の終わり
watany
109
250k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Bash Introduction
62gerente
615
220k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
540
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
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