mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Validate React.Fragment props without Map. (#12504)
This commit is contained in:
committed by
Dan Abramov
parent
fa8e67893f
commit
0c80977061
@@ -30,8 +30,6 @@ let propTypesMisspellWarningShown;
|
||||
let getDisplayName = () => {};
|
||||
let getStackAddendum = () => {};
|
||||
|
||||
let VALID_FRAGMENT_PROPS;
|
||||
|
||||
if (__DEV__) {
|
||||
currentlyValidatingElement = null;
|
||||
|
||||
@@ -65,8 +63,6 @@ if (__DEV__) {
|
||||
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
|
||||
return stack;
|
||||
};
|
||||
|
||||
VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
|
||||
}
|
||||
|
||||
function getDeclarationErrorAddendum() {
|
||||
@@ -257,7 +253,7 @@ function validateFragmentProps(fragment) {
|
||||
const keys = Object.keys(fragment.props);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
if (!VALID_FRAGMENT_PROPS.has(key)) {
|
||||
if (key !== 'children' && key !== 'key') {
|
||||
warning(
|
||||
false,
|
||||
'Invalid prop `%s` supplied to `React.Fragment`. ' +
|
||||
|
||||
Reference in New Issue
Block a user