From 1ed009f567b1ef05c704ddf98edf62b2ba32ccf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Heikkil=C3=A4?= Date: Sat, 31 Mar 2018 16:52:28 +0300 Subject: [PATCH] Validate React.Fragment props without Map. --- packages/react/src/ReactElementValidator.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react/src/ReactElementValidator.js b/packages/react/src/ReactElementValidator.js index c7fdad83ed1ed..2142c4783e3b0 100644 --- a/packages/react/src/ReactElementValidator.js +++ b/packages/react/src/ReactElementValidator.js @@ -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`. ' +