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
【Λ(らむだ)】最近のアプデ情報 / RPALT20250729
lambda
0
130
私とAWSとの関わりの歩み~意志あるところに道は開けるかも?~
nagisa53
1
140
Kiroから考える AIコーディングツールの潮流
s4yuba
1
440
[TechNight #91] Oracle Database 最新パフォーマンス分析手法
oracle4engineer
PRO
3
180
LLM開発を支えるエヌビディアの生成AIエコシステム
acceleratedmu3n
0
340
怖くない!GritQLでBiomeプラグインを作ろうよ
pal4de
1
140
Tiptapで実現する堅牢で柔軟なエディター開発
kirik
1
160
The Madness of Multiple Gemini CLIs Developing Simultaneously with Jujutsu
gunta
1
2.8k
東京海上日動におけるセキュアな開発プロセスの取り組み
miyabit
0
200
MCPと認可まわりの話 / mcp_and_authorization
convto
2
310
M365アカウント侵害時の初動対応
lhazy
7
5.2k
AI によるドキュメント処理を加速するためのOCR 結果の永続化と再利用戦略
tomoaki25
0
150
Featured
See All Featured
Site-Speed That Sticks
csswizardry
10
730
For a Future-Friendly Web
brad_frost
179
9.8k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Side Projects
sachag
455
43k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
760
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
Designing for Performance
lara
610
69k
Embracing the Ebb and Flow
colly
86
4.8k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
860
Faster Mobile Websites
deanohume
308
31k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Visualization
eitanlees
146
16k
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