...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -1208,6 +1208,7 @@ | |||
| 1208 | } | 1208 | } |
| 1209 | } | 1209 | } |
| 1210 | 1210 | ||
| 1211 | var didWarnAboutKeySpread = {}; | ||
| 1211 | function jsxWithValidation(type, props, key, isStaticChildren, source, self) { | 1212 | function jsxWithValidation(type, props, key, isStaticChildren, source, self) { |
| 1212 | { | 1213 | { |
| 1213 | var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to | 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 | if (type === REACT_FRAGMENT_TYPE) { | 1300 | if (type === REACT_FRAGMENT_TYPE) { |
| 1282 | validateFragmentProps(element); | 1301 | validateFragmentProps(element); |
| 1283 | } else { | 1302 | } else { |
@@ -1208,6 +1208,7 @@ | |||
| 1208 | } | 1208 | } |
| 1209 | } | 1209 | } |
| 1210 | 1210 | ||
| 1211 | var didWarnAboutKeySpread = {}; | ||
| 1211 | function jsxWithValidation(type, props, key, isStaticChildren, source, self) { | 1212 | function jsxWithValidation(type, props, key, isStaticChildren, source, self) { |
| 1212 | { | 1213 | { |
| 1213 | var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to | 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 | if (type === REACT_FRAGMENT_TYPE) { | 1300 | if (type === REACT_FRAGMENT_TYPE) { |
| 1282 | validateFragmentProps(element); | 1301 | validateFragmentProps(element); |
| 1283 | } else { | 1302 | } else { |
@@ -23,7 +23,7 @@ | |||
| 23 | ) { | 23 | ) { |
| 24 | __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); | 24 | __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); |
| 25 | } | 25 | } |
| 26 | var ReactVersion = '18.2.0'; | 26 | var ReactVersion = '18.3.0'; |
| 27 | 27 | ||
| 28 | // ATTENTION | 28 | // ATTENTION |
| 29 | // When adding new symbols to this file, | 29 | // When adding new symbols to this file, |
@@ -13,7 +13,7 @@ | |||
| 13 | (global = global || self, factory(global.React = {})); | 13 | (global = global || self, factory(global.React = {})); |
| 14 | }(this, (function (exports) { 'use strict'; | 14 | }(this, (function (exports) { 'use strict'; |
| 15 | 15 | ||
| 16 | var ReactVersion = '18.2.0'; | 16 | var ReactVersion = '18.3.0'; |
| 17 | 17 | ||
| 18 | // ATTENTION | 18 | // ATTENTION |
| 19 | // When adding new symbols to this file, | 19 | // When adding new symbols to this file, |
@@ -4,7 +4,7 @@ | |||
| 4 | "keywords": [ | 4 | "keywords": [ |
| 5 | "react" | 5 | "react" |
| 6 | ], | 6 | ], |
| 7 | "version": "18.2.0", | 7 | "version": "18.3.0", |
| 8 | "homepage": "https://reactjs.org/", | 8 | "homepage": "https://reactjs.org/", |
| 9 | "bugs": "https://github.com/facebook/react/issues", | 9 | "bugs": "https://github.com/facebook/react/issues", |
| 10 | "license": "MIT", | 10 | "license": "MIT", |