Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Optimization: it might be more efficient to apply the mapper function *outside* the render method
// (if the mapper is a function), that could avoid expensive(?) re-rendering of the injector component
// See this test: 'using a custom injector is not too reactive' in inject.js
const newProps = {};
let key;
for (key in props) {
newProps[key] = props[key];
}
const additionalProps = grabStoresFn(context.mobxStores || {}, newProps, context) || {};
for (key in additionalProps) {
newProps[key] = additionalProps[key];
}
return createComponentVNode(VNodeFlags.ComponentUnknown, component, newProps, null, isStateless(component) ? null : this.storeRef);
}
}
render(routeComponentProps: IWithRouterProps) {
return createComponentVNode(VNodeFlags.ComponentUnknown, Com, combineFrom(remainingProps, routeComponentProps), null, wrappedComponentRef);
}
});
public render() {
const selector = this.selector;
selector.shouldComponentUpdate = false;
if (selector.error) {
throw selector.error;
} else {
return normalizeProps(
createComponentVNode(
VNodeFlags.ComponentUnknown,
WrappedComponent,
this.addExtraProps(selector.props),
null,
withRef ? this.setWrappedInstance : null
)
);
}
}
}