Skip to content

Commit 0c80977

Browse files
heikkilamarkogaearon
authored andcommitted
Validate React.Fragment props without Map. (#12504)
1 parent fa8e678 commit 0c80977

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

packages/react/src/ReactElementValidator.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ let propTypesMisspellWarningShown;
3030
let getDisplayName = () => {};
3131
let getStackAddendum = () => {};
3232

33-
let VALID_FRAGMENT_PROPS;
34-
3533
if (__DEV__) {
3634
currentlyValidatingElement = null;
3735

@@ -65,8 +63,6 @@ if (__DEV__) {
6563
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
6664
return stack;
6765
};
68-
69-
VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
7066
}
7167

7268
function getDeclarationErrorAddendum() {
@@ -257,7 +253,7 @@ function validateFragmentProps(fragment) {
257253
const keys = Object.keys(fragment.props);
258254
for (let i = 0; i < keys.length; i++) {
259255
const key = keys[i];
260-
if (!VALID_FRAGMENT_PROPS.has(key)) {
256+
if (key !== 'children' && key !== 'key') {
261257
warning(
262258
false,
263259
'Invalid prop `%s` supplied to `React.Fragment`. ' +

0 commit comments

Comments
 (0)