Skip to content

Commit

Permalink
Validate React.Fragment props without Map. (#12504)
Browse files Browse the repository at this point in the history
  • Loading branch information
heikkilamarko authored and gaearon committed Apr 1, 2018
1 parent fa8e678 commit 0c80977
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/react/src/ReactElementValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ let propTypesMisspellWarningShown;
let getDisplayName = () => {};
let getStackAddendum = () => {};

let VALID_FRAGMENT_PROPS;

if (__DEV__) {
currentlyValidatingElement = null;

Expand Down Expand Up @@ -65,8 +63,6 @@ if (__DEV__) {
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
return stack;
};

VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
}

function getDeclarationErrorAddendum() {
Expand Down Expand Up @@ -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`. ' +
Expand Down

0 comments on commit 0c80977

Please sign in to comment.