[Bug] Claude suggests deprecated React.FormEvent instead of React.SubmitEvent for React 19+ projects

Resolved 💬 4 comments Opened Apr 13, 2026 by meghrathod Closed May 24, 2026

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

  1. Open a React 19+ TypeScript project
  2. Write or ask Claude to write a form onSubmit handler
  3. Claude suggests: (e: React.FormEvent<HTMLFormElement>) => { ... }
  4. Manually correct it to: (e: React.SubmitEvent<HTMLFormElement>) => { ... }
  5. 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

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

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗