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
560
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
190
gitc2016 react based architecture
yiminghe
1
170
antd at qcon2016
yiminghe
1
230
react-based architecture
yiminghe
2
170
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
310
react best practice
yiminghe
3
220
react at alipay
yiminghe
43
4.5k
Other Decks in Technology
See All in Technology
re:Invent2025 セッションレポ ~Spec-driven development with Kiro~
nrinetcom
PRO
2
150
Claude Skillsの テスト業務での活用事例
moritamasami
1
120
TED_modeki_共創ラボ_20251203.pdf
iotcomjpadmin
0
170
日本の AI 開発と世界の潮流 / GenAI Development in Japan
hariby
2
700
AR Guitar: Expanding Guitar Performance from a Live House to Urban Space
ekito_station
0
270
Microsoft Agent Frameworkの可観測性
tomokusaba
1
120
AIBuildersDay_track_A_iidaxs
iidaxs
4
1.6k
日本Rubyの会: これまでとこれから
snoozer05
PRO
6
250
『君の名は』と聞く君の名は。 / Your name, you who asks for mine.
nttcom
1
130
AWSインフルエンサーへの道 / load of AWS Influencer
whisaiyo
0
240
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
3
210
ハッカソンから社内プロダクトへ AIエージェント ko☆shi 開発で学んだ4つの重要要素
leveragestech
0
440
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
1
1.5k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
400
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Writing Fast Ruby
sferik
630
62k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
The World Runs on Bad Software
bkeepers
PRO
72
12k
30 Presentation Tips
portentint
PRO
1
180
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
140
Tell your own story through comics
letsgokoyo
0
770
Game over? The fight for quality and originality in the time of robots
wayneb77
1
71
Making the Leap to Tech Lead
cromwellryan
135
9.7k
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