Property 'value' does not exist on type 'EventTarget' react code example
Example 1: property 'name' does not exist on type 'eventtarget' react
const { name } = event.target as HTMLButtonElement;
Example 2: Property 'value' does not exist on type 'EventTarget & Element'.
(e.target as HTMLButtonElement).value
Example 3: REACT TS roperty 'value' does not exist on type 'EventTarget & Element'
@Zyon Lyod has already provided the code and some explanation but i will add
more details:
The problem is that not all html events have the value property. And thus not all
event.target have that property since event.target is a generic html element
so you need to cast to the html element that you are using
You are welcome,