Wonuola Posted on Mar 9, 2024 How to fix 'Type 'MouseEvent' is not generic.' TypeScript error. #webdev #programming #javascript #typescript A sample image of the TypeScript error. This could be because you're using DOM events. 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) Subscribe Submit Preview Dismiss Collapse Expand Saumil Dhankar Saumil Dhankar Saumil Dhankar Follow Joined May 3, 2025 • Jul 25 Dropdown menu Copy link Hide It does work, where should I read more about this or you teach me :) Code of Conduct • Report abuse
Top comments (1)
It does work, where should I read more about this or you teach me :)