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
550
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
220
支付宝小程序的开放架构
yiminghe
0
190
gitc2016 react based architecture
yiminghe
1
150
antd at qcon2016
yiminghe
1
210
react-based architecture
yiminghe
2
160
React Ecosystem At Ant Financial
yiminghe
4
2.2k
ant design preview
yiminghe
1
280
react best practice
yiminghe
3
200
react at alipay
yiminghe
43
4.3k
Other Decks in Technology
See All in Technology
20250807 Applied Engineer Open House
sakana_ai
PRO
2
570
React Server ComponentsでAPI不要の開発体験
polidog
PRO
0
340
事業特性から逆算したインフラ設計
upsider_tech
0
190
Serverless Meetup #21
yoshidashingo
1
130
Agent Development Kitで始める生成 AI エージェント実践開発
danishi
0
160
Eval-Centric AI: Agent 開発におけるベストプラクティスの探求
asei
0
140
AIに頼りすぎない新人育成術
cuebic9bic
3
320
Google Agentspaceを実際に導入した効果と今後の展望
mixi_engineers
PRO
3
770
AI関数が早くなったので試してみよう
kumakura
0
330
LLMで構造化出力の成功率をグンと上げる方法
keisuketakiguchi
0
1k
[kickflow]20250319_少人数チームでのAutify活用
otouhujej
0
150
AIは変更差分からユニットテスト_結合テスト_システムテストでテストすべきことが出せるのか?
mineo_matsuya
3
1.5k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
695
190k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Into the Great Unknown - MozCon
thekraken
40
2k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Designing Experiences People Love
moore
142
24k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
KATA
mclloyd
32
14k
Docker and Python
trallard
45
3.5k
Git: the NoSQL Database
bkeepers
PRO
431
65k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Rails Girls Zürich Keynote
gr2m
95
14k
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