Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple binding of same event when state change #5

Open
dulanja33 opened this issue Jan 18, 2017 · 0 comments
Open

Multiple binding of same event when state change #5

dulanja33 opened this issue Jan 18, 2017 · 0 comments

Comments

@dulanja33
Copy link

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);
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant