If you’re using TypeScript, you also need to update the types.
npm install --save-exact @types/react@^19.0.0 @types/react-dom@^19.0.0