Answer the question
In order to leave comments, you need to log in
How to correctly specify the type for the onClick event, where target is a button with a name attribute?
I specify the type for event in a similar way. In my understanding, everything should work and I do not understand what is wrong. I would be grateful for help.
const _handleChangeStyle = (e: React.MouseEvent<HTMLButtonElement>) => {
const type = e.target.name // Error: Property 'name' does not exist on type 'EventTarget'.
handleChangeEditorState(RichUtils.toggleBlockType(editorState, type))
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question