Validate React.Fragment props without Map. (#12504)

This commit is contained in:
heikkilamarko
2018-04-01 03:14:36 +03:00
committed by Dan Abramov
parent fa8e67893f
commit 0c80977061
+1 -5
View File
@@ -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`. ' +