...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -1208,6 +1208,7 @@ | ||
| 1208 | 1208 | } |
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | var didWarnAboutKeySpread = {}; | |
| 1211 | 1212 | function jsxWithValidation(type, props, key, isStaticChildren, source, self) { |
| 1212 | 1213 | { |
| 1213 | 1214 | var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to |
@@ -1278,6 +1279,24 @@ | ||
| 1278 | 1279 | } |
| 1279 | 1280 | } |
| 1280 | 1281 | |
| 1282 | { | |
| 1283 | if (hasOwnProperty.call(props, 'key')) { | |
| 1284 | var componentName = getComponentNameFromType(type); | |
| 1285 | var keys = Object.keys(props).filter(function (k) { | |
| 1286 | return k !== 'key'; | |
| 1287 | }); | |
| 1288 | var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}'; | |
| 1289 | ||
| 1290 | if (!didWarnAboutKeySpread[componentName + beforeExample]) { | |
| 1291 | var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}'; | |
| 1292 | ||
| 1293 | error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName); | |
| 1294 | ||
| 1295 | didWarnAboutKeySpread[componentName + beforeExample] = true; | |
| 1296 | } | |
| 1297 | } | |
| 1298 | } | |
| 1299 | ||
| 1281 | 1300 | if (type === REACT_FRAGMENT_TYPE) { |
| 1282 | 1301 | validateFragmentProps(element); |
| 1283 | 1302 | } else { |
@@ -1208,6 +1208,7 @@ | ||
| 1208 | 1208 | } |
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | var didWarnAboutKeySpread = {}; | |
| 1211 | 1212 | function jsxWithValidation(type, props, key, isStaticChildren, source, self) { |
| 1212 | 1213 | { |
| 1213 | 1214 | var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to |
@@ -1278,6 +1279,24 @@ | ||
| 1278 | 1279 | } |
| 1279 | 1280 | } |
| 1280 | 1281 | |
| 1282 | { | |
| 1283 | if (hasOwnProperty.call(props, 'key')) { | |
| 1284 | var componentName = getComponentNameFromType(type); | |
| 1285 | var keys = Object.keys(props).filter(function (k) { | |
| 1286 | return k !== 'key'; | |
| 1287 | }); | |
| 1288 | var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}'; | |
| 1289 | ||
| 1290 | if (!didWarnAboutKeySpread[componentName + beforeExample]) { | |
| 1291 | var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}'; | |
| 1292 | ||
| 1293 | error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName); | |
| 1294 | ||
| 1295 | didWarnAboutKeySpread[componentName + beforeExample] = true; | |
| 1296 | } | |
| 1297 | } | |
| 1298 | } | |
| 1299 | ||
| 1281 | 1300 | if (type === REACT_FRAGMENT_TYPE) { |
| 1282 | 1301 | validateFragmentProps(element); |
| 1283 | 1302 | } else { |