What is the correct type for React Click Event?

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.


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

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

Please refer to this: https://fettblog.eu/typescript-react/events/

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

Hope it helps.


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.