k-ui-react-jquery-wrappers icon indicating copy to clipboard operation
k-ui-react-jquery-wrappers copied to clipboard

Multiple binding of same event when state change

Open dulanja33 opened this issue 8 years ago • 0 comments

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);
	}
}

dulanja33 avatar Jan 18 '17 12:01 dulanja33