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
200
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
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
4.7k
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
Context Engineeringが企業で不可欠になる理由
hirosatogamo
PRO
3
410
ファインディの横断SREがTakumi byGMOと取り組む、セキュリティと開発スピードの両立
rvirus0817
1
1.2k
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
120
【5分でわかる】セーフィー エンジニア向け会社紹介
safie_recruit
0
42k
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.5k
M&A 後の統合をどう進めるか ─ ナレッジワーク × Poetics が実践した組織とシステムの融合
kworkdev
PRO
1
410
Digitization部 紹介資料
sansan33
PRO
1
6.8k
MCPでつなぐElasticsearchとLLM - 深夜の障害対応を楽にしたい / Bridging Elasticsearch and LLMs with MCP
sashimimochi
0
140
20260204_Midosuji_Tech
takuyay0ne
0
110
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
4
1.3k
Featured
See All Featured
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Side Projects
sachag
455
43k
Thoughts on Productivity
jonyablonski
74
5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Building the Perfect Custom Keyboard
takai
2
680
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Designing for Timeless Needs
cassininazir
0
130
So, you think you're a good person
axbom
PRO
2
1.9k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
240
sira's awesome portfolio website redesign presentation
elsirapls
0
140
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
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