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
540
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
200
支付宝小程序的开放架构
yiminghe
0
180
gitc2016 react based architecture
yiminghe
1
140
antd at qcon2016
yiminghe
1
200
react-based architecture
yiminghe
2
150
React Ecosystem At Ant Financial
yiminghe
4
2.2k
ant design preview
yiminghe
1
270
react best practice
yiminghe
3
190
react at alipay
yiminghe
43
4.3k
Other Decks in Technology
See All in Technology
ソフトウェア開発現代史: "LeanとDevOpsの科学"の「科学」とは何か? - DORA Report 10年の変遷を追って - #開発生産性_findy
takabow
1
330
TypeScript をより型安全に扱うプラクティス #TSKaigi #TSKaigi2025_kataritai
bengo4com
0
2.1k
FASTと向き合うことで見えた、大規模アジャイルの難しさと楽しさ
wooootack
0
460
AIエージェント実践集中コース LT
okaru
1
200
Securing your Lambda 101
chillzprezi
0
160
基調講演: 生成AIを活用したアプリケーションの開発手法とは?
asei
1
100
JavaのMCPサーバーで体験するAIエージェントの世界
tatsuya1bm
1
220
ai bot got sick (abc 2025s version)
kojira
0
160
Two-Tower モデルで実現する 検索リランキング / Shibuya_AI_2
visional_engineering_and_design
2
140
メルカリにおけるデータアナリティクス AI エージェント「Socrates」と ADK 活用事例
na0
15
8.3k
Grafana MCP serverでなんかし隊 / Try Grafana MCP server
kohbis
0
290
開発効率と信頼性を両立する Ubieのプラットフォームエンジニアリング
teru0x1
0
120
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
76
5.8k
Become a Pro
speakerdeck
PRO
28
5.4k
How GitHub (no longer) Works
holman
314
140k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
The World Runs on Bad Software
bkeepers
PRO
68
11k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Adopting Sorbet at Scale
ufuk
77
9.4k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.8k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
Balancing Empowerment & Direction
lara
1
110
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