diff --git a/src/utils.js b/src/utils.js index 1504f42..3bc215f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,3 +1,4 @@ +import { isValidElement } from 'react' import loadScript from 'load-script' import merge from 'deepmerge' @@ -144,12 +145,15 @@ export function isObject (val) { return val !== null && typeof val === 'object' } -// Deep comparison of two objects but ignoring -// functions, for use in shouldComponentUpdate +// Deep comparison of two objects, but ignoring functions +// and React elements, for use in shouldComponentUpdate export function isEqual (a, b) { if (typeof a === 'function' && typeof b === 'function') { return true } + if (isValidElement(a) && isValidElement(b)) { + return true + } if (a instanceof Array && b instanceof Array) { if (a.length !== b.length) { return false