We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33d1edf commit 48c7b53Copy full SHA for 48c7b53
packages/react/src/ReactElement.js
@@ -12,6 +12,8 @@ import ReactCurrentOwner from './ReactCurrentOwner';
12
13
const hasOwnProperty = Object.prototype.hasOwnProperty;
14
15
+const invariant = require('fbjs/lib/invariant');
16
+
17
const RESERVED_PROPS = {
18
key: true,
19
ref: true,
@@ -290,10 +292,10 @@ export function cloneAndReplaceKey(oldElement, newKey) {
290
292
* See https://reactjs.org/docs/react-api.html#cloneelement
291
293
*/
294
export function cloneElement(element, config, children) {
-
- if (!element) {
295
- throw new TypeError('Cannot clone null or undefined.');
296
- }
+ invariant(
+ !(element === null || element === undefined),
297
+ 'Cannot clone a null or undefined element.'
298
+ );
299
300
let propName;
301
0 commit comments