10 examples of 'componentwillreceiveprops alternative' in JavaScript

Every line of 'componentwillreceiveprops alternative' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
41componentWillReceiveProps(nextProps) {
42 const { defaultDisplay } = this.props;
43
44 if (nextProps.defaultDisplay !== defaultDisplay) {
45 this.props.setValue([nextProps.defaultDisplay]);
46 }
47}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

93componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
94 this.setState(getCursorStates(nextProps.cursors));
95},
50componentWillReceiveProps (newProps) {
51 if (this.state.entity !== newProps.entity) {
52 this.setState({entity: newProps.entity});
53 }
54 if (this.state.name !== newProps.name) {
55 this.setState({name: newProps.name});
56 }
57}
392Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
393 if (!pure || !(0, _shallowEqual2["default"])(nextProps, this.props)) {
394 this.haveOwnPropsChanged = true;
395 }
396 };
308Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
309 if (!pure || !shallowEqual(nextProps, this.props)) {
310 this.haveOwnPropsChanged = true;
311 }
312 };
37DataController.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
38 if (this.props.showFilter !== nextProps.showFilter || this.props.filterLabel !== nextProps.filterLabel) {
39 this.setQueryInfo(nextProps);
40 this.setValue(this.defaultSelected);
41 }
42 if (this.props.defaultSelected !== nextProps.defaultSelected) {
43 this.setValue(nextProps.defaultSelected);
44 }
45};
51componentWillReceiveProps(nextProps) {
52 this.setState({
53 ...this.state,
54 value: nextProps.value,
55 });
56}
55value: function componentWillReceiveProps(nextProps) {
56 var _props = this.props,
57 height = _props.height,
58 width = _props.width;
59
60 if (nextProps.width !== width || nextProps.height !== height) {
61 this._notifySizeChange = true;
62 }
63}
61value: function componentWillReceiveProps(nextProps) {
62 if (this.props.enabled !== nextProps.enabled) {
63 var fn = nextProps.enabled ? this.listenToScrollEvents : this.stopListeningToScrollEvents;
64
65 fn(this.scrollingElement);
66 }
67}
54value: function componentWillReceiveProps(nextProps) {
55 var _props = this.props;
56 var actionsById = _props.actionsById;
57 var dispatch = _props.dispatch;
58 var stagedActionIds = _props.stagedActionIds;
59
60
61 if (nextProps.stagedActionIds !== stagedActionIds) {
62 for (var i = stagedActionIds.length; i < nextProps.stagedActionIds.length; i++) {
63 var actionId = nextProps.stagedActionIds[i];
64 var action = actionsById[actionId];
65 var appState = nextProps.computedStates[i].state;
66
67 dispatch((0, _actions.addActionMetadata)({ action: action, actionId: actionId, appState: appState }));
68 }
69 }
70}

Related snippets