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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
170
React Ecosystem At Ant Financial
yiminghe
4
2.3k
ant design preview
yiminghe
1
320
react best practice
yiminghe
3
230
react at alipay
yiminghe
43
4.5k
Other Decks in Technology
See All in Technology
俺の失敗を乗り越えろ!メーカーの開発現場での失敗談と乗り越え方 ~ゆるゆるチームリーダー編~
spiddle
0
400
LLM活用の壁を超える:リクルートR&Dの戦略と打ち手
recruitengineers
PRO
1
170
primeNumber DATA MANAGEMENT CAMP #2:
masatoshi0205
1
630
Eight Engineering Unit 紹介資料
sansan33
PRO
1
6.8k
AIに視覚を与えモバイルアプリケーション開発をより円滑に行う
lycorptech_jp
PRO
1
570
インシデント対応入門
grimoh
7
5.5k
AIエンジニア Devin と歩む、自律型運用プロセスの構築
a2ito
0
320
ローカルでLLMを使ってみよう
kosmosebi
0
210
論文検索を日本語でできるアプリを作ってみた
sailen2
0
140
マイグレーションガイドに書いてないRiverpod 3移行話
taiju59
0
330
LINE Messengerの次世代ストレージ選定
lycorptech_jp
PRO
0
370
What's new in Go 1.26?
ciarana
2
260
Featured
See All Featured
Docker and Python
trallard
47
3.7k
Un-Boring Meetings
codingconduct
0
220
Building an army of robots
kneath
306
46k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
130
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
KATA
mclloyd
PRO
35
15k
WENDY [Excerpt]
tessaabrams
9
36k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
220
Game over? The fight for quality and originality in the time of robots
wayneb77
1
130
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4k
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