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
form validation in react
do form validation using react
yiminghe
March 19, 2015
More Decks by yiminghe
See All by yiminghe
小程序终端技术架构
yiminghe
0
270
支付宝小程序的开放架构
yiminghe
0
200
gitc2016 react based architecture
yiminghe
1
180
antd at qcon2016
yiminghe
1
240
react-based architecture
yiminghe
2
180
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
330
react best practice
yiminghe
3
230
react at alipay
yiminghe
43
4.5k
Other Decks in Technology
See All in Technology
AI時代における技術的負債への取り組み
codenote
1
1.7k
AIが書いたコードを信じられない問題 〜レビュー負荷を下げるために変えたこと〜 / The AI Code Trust Gap: Reducing the Review Burden
bitkey
PRO
8
1.4k
コミュニティ・勉強会を作るのは目的じゃない
ohmori_yusuke
0
260
「責任あるAIエージェント」こそ自社で開発しよう!
minorun365
9
2.2k
Microsoft 365 / Microsoft 365 Copilot : 自分の状態を確認する「ラベル」について
taichinakamura
0
350
色を視る
yuzneri
0
110
ServiceNow Knowledge 26 の歩き方
manarobot
0
160
今年注目する!データ分析プラットフォームでのAIの活用
nayuts
0
160
レビューしきれない?それは「全て人力でのレビュー」だからではないでしょうか
amixedcolor
0
350
ハーネスエンジニアリングをやりすぎた話 ~そのハーネスは解体された~
gotalab555
5
1.8k
LLM時代の検索アーキテクチャと技術的意思決定
shibuiwilliam
3
1.5k
260422_Sansan_Tech_Talk__関西_vol.3_データ活用のリアル__矢田__.pdf
sansantech
PRO
0
120
Featured
See All Featured
Heart Work Chapter 1 - Part 1
lfama
PRO
6
35k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
180
Test your architecture with Archunit
thirion
1
2.2k
The untapped power of vector embeddings
frankvandijk
2
1.7k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
540
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
130
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1k
Faster Mobile Websites
deanohume
310
31k
Facilitating Awesome Meetings
lara
57
6.8k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Typedesign – Prime Four
hannesfritz
42
3k
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