uppy/packages/@uppy/react/src/nonHtmlPropsHaveChanged.js
Antoine du Hamel 6b68876c68
@uppy/react: propagate prop mutation (#3208)
* @uppy/react: propagate prop mutation

Fixes: https://github.com/transloadit/uppy/issues/3203

* fixup! @uppy/react: propagate prop mutation

* fixup! @uppy/react: propagate prop mutation

* Apply changes to other Components

* Update TODOs
2021-09-28 16:57:58 +02:00

10 lines
456 B
JavaScript

'use strict'
// TODO: replace with `Object.hasOwn` when dropping support for older browsers.
const hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key)
module.exports = function nonHtmlPropsHaveChanged (component, prevProps) {
return Object.keys(component.props)
// TODO: replace `validProps` with an exported `Symbol('htmlProps')`.
.some(key => !hasOwn(component.validProps, key) && component.props[key] !== prevProps[key])
}