Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setProps(props : (PropsType & P), isUpdate : boolean = false) {
if (this.component.validate) {
this.component.validate(this.component, props);
}
// $FlowFixMe
this.props = this.props || {};
extend(this.props, normalizeProps(this.component, this, props, isUpdate));
}
ChildComponent.prototype.setProps = function setProps(props, origin) {
var required = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
// $FlowFixMe
this.props = this.props || {};
var normalizedProps = normalizeChildProps(this.parentComponentWindow, this.component, props, origin, required);
extend(this.props, normalizedProps);
for (var _i4 = 0, _onPropHandlers2 = this.onPropHandlers, _length4 = _onPropHandlers2 == null ? 0 : _onPropHandlers2.length; _i4 < _length4; _i4++) {
var handler = _onPropHandlers2[_i4];
handler.call(this, this.props);
}
window.xprops = this.component.xprops = this.props;
};
ParentComponent.prototype.setProps = function setProps(props) {
var isUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (this.component.validate) {
this.component.validate(this.component, props);
}
// $FlowFixMe
this.props = this.props || {};
extend(this.props, normalizeProps(this.component, this, props, isUpdate));
};
componentDidMount() {
component.log(`instantiate_react_component`);
const el = ReactDOM.findDOMNode(this);
const parent = component.init(extend({}, this.props));
parent.render(el, CONTEXT.IFRAME);
this.setState({ parent });
}
setProps(props : PropsType<p>, origin : string, isUpdate : boolean = false) {
const helpers = this.getHelpers();
const existingProps = this.getProps();
const normalizedProps = normalizeChildProps(this.parentComponentWindow, this.component, props, origin, helpers, isUpdate);
extend(existingProps, normalizedProps);
for (const handler of this.onPropHandlers) {
handler.call(this, existingProps);
}
}
</p>
componentDidUpdate() {
if (this.state && this.state.parent) {
this.state.parent.updateProps(extend({}, this.props)).catch(noop);
}
}
};