-
Notifications
You must be signed in to change notification settings - Fork 49.1k
Turn on key spread warning in jsx-runtime for everyone #25697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,9 +282,12 @@ describe('ReactElement.jsx', () => { | |
expect(() => | ||
ReactDOM.render(JSXRuntime.jsx(Parent, {}), container), | ||
).toErrorDev( | ||
'Warning: React.jsx: Spreading a key to JSX is a deprecated pattern. ' + | ||
'Explicitly pass a key after spreading props in your JSX call. ' + | ||
'E.g. <Child {...props} key={key} />', | ||
'Warning: An props object containing a "key" prop is being spread into JSX:\n' + | ||
' let props = {key: ...};\n' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a non-trivial change in the code but I'll try. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, maybe it doesn't make sense. Because it still writes out the other properties with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put the key in the front even if that's not the regular order and kept |
||
' <Child {...props} />\n' + | ||
'React keys must be passed directly to JSX without using spread:\n' + | ||
' let props = {};\n' + | ||
' <Child key={...} {...props} />', | ||
); | ||
}); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.