k-ui-react-jquery-wrappers
k-ui-react-jquery-wrappers copied to clipboard
Multiple binding of same event when state change
componentWillReceiveProps: function () {
function componentWillReceiveProps(nextProps) {
//always update the widget with nextProp changes if avaliable
if (nextProps.events) {
this.bindEventsToKendoWidget(nextProps.events);
}
}
here when props change the same event binds again and again. Is there any better way to stop this?
I think this should be changed like
if (nextProps.events) {
if ((0, _deepDiff2['default'])(nextProps.events, this.props.events)) {
this.bindEventsToKendoWidget(nextProps.events);
}
}