Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
240
支付宝小程序的开放架构
yiminghe
0
190
gitc2016 react based architecture
yiminghe
1
170
antd at qcon2016
yiminghe
1
230
react-based architecture
yiminghe
2
160
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
310
react best practice
yiminghe
3
210
react at alipay
yiminghe
43
4.4k
Other Decks in Technology
See All in Technology
RAG/Agent開発のアップデートまとめ
taka0709
0
170
eBPFとwaruiBPF
sat
PRO
4
2.6k
評価駆動開発で不確実性を制御する - MLflow 3が支えるエージェント開発
databricksjapan
1
160
【AWS re:Invent 2025速報】AIビルダー向けアップデートをまとめて解説!
minorun365
4
510
Sansanが実践する Platform EngineeringとSREの協創
sansantech
PRO
2
840
AWS Security Agentの紹介/introducing-aws-security-agent
tomoki10
0
210
エンジニアリングをやめたくないので問い続ける
estie
2
1.2k
AI 駆動開発勉強会 フロントエンド支部 #1 w/あずもば
1ftseabass
PRO
0
350
Haskell を武器にして挑む競技プログラミング ─ 操作的思考から意味モデル思考へ
naoya
6
1.5k
MLflowで始めるプロンプト管理、評価、最適化
databricksjapan
1
210
Rubyで楽して タスクを書きたい!
ahogappa
0
110
意外とあった SQL Server 関連アップデート + Database Savings Plans
stknohg
PRO
0
310
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Writing Fast Ruby
sferik
630
62k
Context Engineering - Making Every Token Count
addyosmani
9
510
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Designing Experiences People Love
moore
143
24k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Faster Mobile Websites
deanohume
310
31k
Code Reviewing Like a Champion
maltzj
527
40k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
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