diff --git a/dist/utils/compare-props.js b/dist/utils/compare-props.js index 8716f95..05589ea 100644 --- a/dist/utils/compare-props.js +++ b/dist/utils/compare-props.js @@ -14,7 +14,7 @@ exports['default'] = function (props, nextProps) { for (var i = 0; i < propsKeys.length; i++) { var key = propsKeys[i]; - if (key !== 'children' && (!nextProps.hasOwnProperty(key) || props[key] !== nextProps[key])) { + if (key !== 'children' && key.indexOf('on') !== 0 && (!nextProps.hasOwnProperty(key) || props[key] !== nextProps[key])) { return false; } } diff --git a/src/utils/__tests__/compare-props-test.js b/src/utils/__tests__/compare-props-test.js index 680b465..3e8550c 100644 --- a/src/utils/__tests__/compare-props-test.js +++ b/src/utils/__tests__/compare-props-test.js @@ -25,7 +25,12 @@ describe('compareProps', () => { }); it('ignores the `children` property', () => { - const result = compareProps({a: 1, children: 1}, {a: 1, children: 2}); + const result = compareProps({children: 1}, {children: 2}); + expect(result).toBe(true); + }); + + it('ignores the `on*` properties', () => { + const result = compareProps({onClick: () => {}}, {onClick: () => {}}); expect(result).toBe(true); }); diff --git a/src/utils/compare-props.js b/src/utils/compare-props.js index 495c718..ba2c9b6 100644 --- a/src/utils/compare-props.js +++ b/src/utils/compare-props.js @@ -8,7 +8,7 @@ export default (props, nextProps) => { for (let i = 0; i < propsKeys.length; i++) { const key = propsKeys[i]; - if (key !== 'children' && + if ((key !== 'children' && key.indexOf('on') !== 0) && (!nextProps.hasOwnProperty(key) || props[key] !== nextProps[key])) { return false; }