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
260
支付宝小程序的开放架构
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
昔話で振り返るAWSの歩み ~S3誕生から20年、クラウドはどう進化したのか~
nrinetcom
PRO
0
110
Why we keep our community?
kawaguti
PRO
0
330
The essence of decision-making lies in primary data
kaminashi
0
160
Oracle Cloud Infrastructure:2026年3月度サービス・アップデート
oracle4engineer
PRO
0
130
20260323_データ分析基盤でGeminiを使う話
1210yuichi0
0
190
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
2
17k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
Astro Islandsの 内部実装を 「日本で一番わかりやすく」 ざっくり解説!
knj
0
310
「通るまでRe-run」から卒業!落ちないテストを書く勘所
asumikam
2
820
夢の無限スパゲッティ製造機 #phperkaigi
o0h
PRO
0
390
FlutterでPiP再生を実装した話
s9a17
0
220
「捨てる」を設計する
kubell_hr
0
440
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
Designing for humans not robots
tammielis
254
26k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
230
So, you think you're a good person
axbom
PRO
2
2k
Evolving SEO for Evolving Search Engines
ryanjones
0
170
Being A Developer After 40
akosma
91
590k
The Curse of the Amulet
leimatthew05
1
11k
Why Our Code Smells
bkeepers
PRO
340
58k
Building Adaptive Systems
keathley
44
3k
Google's AI Overviews - The New Search
badams
0
950
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Side Projects
sachag
455
43k
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