Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions packages/react/src/ReactElementProd.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ import {checkKeyStringCoercion} from 'shared/CheckStringCoercion';

import ReactCurrentOwner from './ReactCurrentOwner';

const RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true,
};

let specialPropKeyWarningShown,
specialPropRefWarningShown,
didWarnAboutStringRefs;
Expand Down Expand Up @@ -237,7 +230,12 @@ export function createElement(type, config, children) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) &&
!RESERVED_PROPS.hasOwnProperty(propName)
// Skip over reserved prop names
propName !== 'key' &&
// TODO: These will no longer be reserved in the next major
propName !== 'ref' &&
propName !== '__self' &&
propName !== '__source'
) {
props[propName] = config[propName];
}
Expand Down Expand Up @@ -375,7 +373,12 @@ export function cloneElement(element, config, children) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) &&
!RESERVED_PROPS.hasOwnProperty(propName)
// Skip over reserved prop names
propName !== 'key' &&
// TODO: These will no longer be reserved in the next major
propName !== 'ref' &&
propName !== '__self' &&
propName !== '__source'
) {
if (config[propName] === undefined && defaultProps !== undefined) {
// Resolve default props
Expand Down
21 changes: 12 additions & 9 deletions packages/react/src/jsx/ReactJSXElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ import {checkKeyStringCoercion} from 'shared/CheckStringCoercion';

const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;

const RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true,
};

let specialPropKeyWarningShown;
let specialPropRefWarningShown;
let didWarnAboutStringRefs;
Expand Down Expand Up @@ -244,7 +237,12 @@ export function jsx(type, config, maybeKey) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) &&
!RESERVED_PROPS.hasOwnProperty(propName)
// Skip over reserved prop names
propName !== 'key' &&
// TODO: These will no longer be reserved in the next major
propName !== 'ref' &&
propName !== '__self' &&
propName !== '__source'
) {
props[propName] = config[propName];
}
Expand Down Expand Up @@ -316,7 +314,12 @@ export function jsxDEV(type, config, maybeKey, source, self) {
for (propName in config) {
if (
hasOwnProperty.call(config, propName) &&
!RESERVED_PROPS.hasOwnProperty(propName)
// Skip over reserved prop names
propName !== 'key' &&
// TODO: These will no longer be reserved in the next major
propName !== 'ref' &&
propName !== '__self' &&
propName !== '__source'
) {
props[propName] = config[propName];
}
Expand Down