Skip to content

Commit

Permalink
throw error if passed undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole Levy committed Apr 4, 2018
1 parent b15b165 commit 7bc5fd5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react/src/ReactElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ export function cloneAndReplaceKey(oldElement, newKey) {
* See https://reactjs.org/docs/react-api.html#cloneelement
*/
export function cloneElement(element, config, children) {
if (element === undefined) {
throw new Error("Cannot call 'cloneElement' on undefined.");
}

let propName;

// Original props are copied
Expand Down

1 comment on commit 7bc5fd5

@CBDB1LOVE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/react/src/ReactElement.js

Please sign in to comment.