最近剛好在複習 TypeScript,就順便介紹一下怎麼在 React 裡面使用 TypeScript,並使用 ZOD 做 Schema Validation。
Github:https://github.com/WeiYun0912
個人網站筆記:https://wei-docusaurus-vercel.vercel....
TypeScript - 使用 ZOD 進行型別驗證 (TypeScript ZOD, Schema Validation):
• TypeScript - 使用 ZOD 進行型別驗證 (TypeScrip...
使用 ZOD 進行表單驗證 (React-Hook-Form、Formik、ZOD): • React教學 - 使用 ZOD 進行表單驗證 (React-Hook-F...
參考資料:udemy 課程 React & TypeScript - The Practical Guide Academind by Maximilian Schwarzmüller, Maximilian Schwarzmüller
(暫時不接外包)
0:00 說明
1:10 建立 Components
2:10 useState Generic Type
5:00 新增資料 (handleAddUser)
7:25 定義 AddUser Component 的 Props Type
10:52 FormEvent
12:53 useRef Generic Type
16:49 定義 UserList Component 的 Props Type
19:51 刪除資料 (handleDeleteUser)
22:01 User Component
25:30 Zod Schema Validation
---------------------------------------
社交媒體:
IG: / weiwei225
#react #typescript #zod