Accepted answer

If you create a <button> and hover over onClick prop you'll get the type in the tooltip:

enter image description here

In your example code, you are creating a custom button so the types depend on the implementation of that component.


This seems like a reasonable explanation:



I believe the type you are looking for is React.MouseEvent, a synthetic event provided by React. More info and examples may be found here.


For typings you should have TypeScript where you can do this:

const handleBtnClick = (e: React.MouseEvent<HTMLButtonElement>) => { ... }

Please refer to this:

Of course, you could try it without TypeScript but is not worth it.

Hope it helps.

Related Query

More Query from same tag