@samitouri / QOS-React-2 / commits / 0c80977061

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

heikkilamarko committed Apr 1, 2018 at 03:14 UTC 0c80977061ba576cee9ae0891245be233929d2ed
1 file changed +1 -5
packages/react/src/ReactElementValidator.js
+1 -5
@@ -30,8 +30,6 @@ let propTypesMisspellWarningShown;
30 let getDisplayName = () => {};
31 let getStackAddendum = () => {};
32
33 -let VALID_FRAGMENT_PROPS;
34 -
33 if (__DEV__) {
34 currentlyValidatingElement = null;
35
@@ -65,8 +63,6 @@ if (__DEV__) {
63 stack += ReactDebugCurrentFrame.getStackAddendum() || '';
64 return stack;
65 };
68 -
69 - VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
66 }
67
68 function getDeclarationErrorAddendum() {
@@ -257,7 +253,7 @@ function validateFragmentProps(fragment) {
253 const keys = Object.keys(fragment.props);
254 for (let i = 0; i < keys.length; i++) {
255 const key = keys[i];
260 - if (!VALID_FRAGMENT_PROPS.has(key)) {
256 + if (key !== 'children' && key !== 'key') {
257 warning(
258 false,
259 'Invalid prop `%s` supplied to `React.Fragment`. ' +