React Course - TypeScript - Forms and Events

  Рет қаралды 19,013

Techbase

Techbase

3 жыл бұрын

Learn how to use Forms and Events with TypeScript.
🔥 Want to become a React Expert? Checkout my course here: techbase.dev
✔️ Starter code: bit.ly/3AyZ4ZQ
🏁 Finished code: bit.ly/3jM8jzV
☝️ How to use the code above: bit.ly/3hmXYcm
🔗 Connect 🔗
Techbase: techbase.dev
Discord: / discord
PayPal: paypal.me/mitcheltechbase

Пікірлер: 12
@PrashanthPuranik
@PrashanthPuranik 2 жыл бұрын
The trick of setting up the event handler inline to check the type of event is super useful. I was using the native JS Event type till today and realized the type should be the synthetic events defined by React after watching your video.
@tabliqatchi6696
@tabliqatchi6696 2 жыл бұрын
I searched the whole internet to find this technique that you just showed lol changing the event handler to inline form and finding the proper type to use. Thanks a lot 💖.
@roshiniacsah2051
@roshiniacsah2051 2 жыл бұрын
You made event type declaration simple Thanks a LOT
@thexpand
@thexpand Жыл бұрын
Alternatively, you could also use the ChangeEventHandler as a type for the input's onChange handler function. Respectively FormEventHandler for the form's onSubmit handler.
@TauwinKul
@TauwinKul Жыл бұрын
Thank you very much. I have been looking for such an example for a long time. Either a library is used or Javascript. I am almost desperate. For me as a beginner in React, clean examples are important. Thank you
@bakaleisanich
@bakaleisanich 2 жыл бұрын
thank you)
@patrickmisner372
@patrickmisner372 Жыл бұрын
Wish you had some examples for other field types in your formData, currently struggling with an inputnumber field for the past 30 minutes.
@hichamamroussi9087
@hichamamroussi9087 7 ай бұрын
What if you have an input type file in the form, how do you handle it?
@romimaximus
@romimaximus 2 жыл бұрын
I have a question ? Ok, i know you have to define a interface when using useState() hook, ... but why Typescript doesn´t give you an error for the "const defaultFormData = { title:'', body:'' } " ?, .. that´s confusing my brain.. lolll...sorry im just curious why ?
@TechbaseDev
@TechbaseDev 2 жыл бұрын
Well it is actually not required to use an interface when using a useState hook. TypeScript is smart enough to infer the type of defaultFormData. However, let's imagine I want to pass a property "address" (which is not defined within defaultFormData), then TypeScript will let me know that I can not just pass address to the formData.
@romimaximus
@romimaximus 2 жыл бұрын
@@TechbaseDev thank you very much, for your help !! and im learning a lot from you React Tuts Videos Playlist, its awesome..😎👍
@hin5217
@hin5217 Жыл бұрын
Just use 4 mins to explain the details that people need more than an hour. Thx!!!!!
Why you SHOULD be using TypeScript with React
14:55
PedroTech
Рет қаралды 25 М.
React Course - TypeScript - Generic Components
8:18
Techbase
Рет қаралды 11 М.
Homemade Professional Spy Trick To Unlock A Phone 🔍
00:55
Crafty Champions
Рет қаралды 58 МЛН
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 107 МЛН
Luck Decides My Future Again 🍀🍀🍀 #katebrush #shorts
00:19
Kate Brush
Рет қаралды 8 МЛН
EVERYTHING You Need to Know to Use TypeScript with Node/React
1:07:51
TypeScript in React - COMPLETE Tutorial (Crash Course)
53:21
ByteGrad
Рет қаралды 209 М.
Upload Files in React - Typescript, Drag and Drop, & Form Examples
12:21
React Context API with TypeScript | UserContext React TypeScript
14:47
WebDevWithArtisan
Рет қаралды 13 М.
How to use TypeScript with React... But should you?
6:36
Fireship
Рет қаралды 906 М.
React Typescript Tutorial
30:49
Piyush Garg
Рет қаралды 24 М.
Handling Complex Multiple Input Form States in React [2 LINES ONLY]
6:57
React Hook Form - Complete Tutorial (with Zod)
28:22
Cosden Solutions
Рет қаралды 86 М.
React Tutorial for Beginners
1:20:04
Programming with Mosh
Рет қаралды 2,7 МЛН
React Course - TypeScript - Enums
10:24
Techbase
Рет қаралды 9 М.
Homemade Professional Spy Trick To Unlock A Phone 🔍
00:55
Crafty Champions
Рет қаралды 58 МЛН