[Bug] Claude suggests deprecated React.FormEvent instead of React.SubmitEvent for React 19+ projects
Summary
When working in a React 19+ project, Claude Code consistently suggests or reverts form submit event handler types to the deprecated React.FormEvent<HTMLFormElement>, even after the user has manually corrected them to the current React.SubmitEvent<HTMLFormElement>.
Steps to Reproduce
- Open a React 19+ TypeScript project
- Write or ask Claude to write a form
onSubmithandler - Claude suggests:
(e: React.FormEvent<HTMLFormElement>) => { ... } - Manually correct it to:
(e: React.SubmitEvent<HTMLFormElement>) => { ... } - On the next edit or review pass, Claude reverts or re-suggests the deprecated type
Expected Behavior
Claude should use React.SubmitEvent<HTMLFormElement> for form submit handlers when the project is on React 19+, where React.FormEvent is deprecated.
Actual Behavior
Claude uses React.FormEvent<HTMLFormElement> regardless of the React version, forcing users to repeatedly fix the same deprecation.
Context
React.FormEvent/React.FormEventHandlerwere deprecated in React v19.2.10- The correct replacement is
React.SubmitEvent<HTMLFormElement> - Reference: https://github.com/remix-run/react-router/issues/14795
Environment
- React version: 19+
- TypeScript project
Suggested Fix
Claude should detect the React version from package.json and use the appropriate event types. For React >= 19, prefer React.SubmitEvent over React.FormEvent for form submit handlers.
🤖 Reported via Claude Code
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗