DEV Community

Wonuola
Wonuola

Posted on

How to fix 'Type 'MouseEvent' is not generic.' TypeScript error.

A sample image of the TypeScript error.
This could be because you're using DOM events.
Error using TypeScript

Here is the solution:

 const onSubmit = async (e: 
React.MouseEvent<HTMLButtonElement>) => {
    e.preventDefault();
}
Enter fullscreen mode Exit fullscreen mode

Let me know if it works. Cheers ;)

Top comments (1)

Collapse
 
saumildhankar profile image
Saumil Dhankar

It does work, where should I read more about this or you teach me :)