React TypeScript Tutorial - 6 - Event Props

preview_player
Показать описание

📱 Follow Codevolution

Event Props with React and TypeScript
Рекомендации по теме
Комментарии
Автор

You mentioned that the event type doesn't need to be memorized and can be copy/pasted - this is true, but you didn't mention a handy way to do this without leaving the editor - assuming you have typescript extension. You just mouseover the 'event' parameter in the onClick attribute's arrow function in the button element. It will display the event's type and you can copy it.

// mouse over 'event' below and VS Code will show you the spec for event, including its type:
// (parameter) event: React.MouseEvent<HTMLButtonElement, MouseEvent>
export const Blah = () => {
return <button onClick={event => {}} />
}

endthefed
Автор

Great video to learn the basics to cement your knowledge. My issue is I sometimes struggle more with errors of typescript then my actual code 😂. Its also fun when you have to use types from packages and you dont know what type it should be 😅

fabianpetersen
Автор

You explain everything very easy way
Thanks, sir

xogecz
Автор

Hi @Codevolution There's a bit of confusion as to why you passed a variable id to the handleClick in the App component. Where is id coming from? And why are we hard coding it as 1 in the component. It's a bit confusing for me. Does anyone else get confused here? does any one understand what's going on?

babsake
Автор

Hello from Ukraine ! :)
Thank you so much!!!

maksymradchenko
Автор

@4:08 I do not know if it is essential to pass the id there. Usually only the event is the parameter in that case.

papa_ethan
Автор

3:28 - 3:33 got me just know where to find it and copy paste it 😇🙃

evaristusjean
Автор

finally I found why I have err in my typescript. thank you

sdfsdfsdffdsfsdfsd
Автор

Please do a React + DDD tutorial (clean architecture), greetings from Medellín, Colombia.

jhormanorozco
Автор

Why did you create another handleInputChange in Input element when the props.handleChange contains the function coming from the parent element?

jcsantos
Автор

at 4:06
Why doesn't typescript show an error while defining the function for handleClick props?
According to the type, handleClick function needs to have an event and an id. However, at time 4:06 no id is yet passed but no error is shown

aqsamustafa
Автор

Why did we add an id on the handleClick function? What is the purpose?

liotechtutorials
Автор

Good job was done!!! However, is it possible to record real results from the screen while using that code

asselgabdullina
Автор

hey. on 06:47, you dont need to set the return type of the handleInputChange function to void?

urieldahan
Автор

Thank you, my friend, you help me a lot!

Автор

sir i completed the playlist please upload more about react typescript

frankenstein
Автор

Dear Sir,

Request you to please provide some video on react-native (mobile app demo) using type script

sourabhgera
Автор

Thanks a lot for you lessons. I really enjoyed the previous lessons but tbh, I'm not enjoying these lessons on Typescript and I'd love to ask whether it's compulsory to learn Typescript with React?

MauriceTheMagnificent
Автор

getting this error in both input and button
"'Button' cannot be used as a JSX component.
Its return type 'void' is not a valid JSX element."

Lone_Khan
Автор

where can we get your files of code to download?

SS-xtul
welcome to shbcf.ru