Skip to content
Merged
Next Next commit
throw error if passed undefined
  • Loading branch information
Nicole Levy committed Apr 4, 2018
commit 7bc5fd5024323588bf280f6cda4327237babea2c
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