Commit 9e858939 authored by Robert Knight's avatar Robert Knight

Remove unnecessary `$onInit` callback

It turns out that `$onChanges` is invoked both when the component is
initially created as well as subsequent updates. Therefore `$onInit` and
`$onChanges` duplicated work and components were rendered twice during
initial creation.
parent 50b0996b
......@@ -63,19 +63,10 @@ class ReactController {
});
}
$onInit() {
// Copy properties supplied by the parent Angular component to React props.
Object.keys(this.type.propTypes).forEach(propName => {
if (!useExpressionBinding(propName)) {
this.props[propName] = this[propName];
}
});
this.updateReactComponent();
}
$onChanges(changes) {
// Copy updated property values from parent Angular component to React
// props.
// props. This callback is run when the component is initially created as
// well as subsequent updates.
Object.keys(changes).forEach(propName => {
if (!useExpressionBinding(propName)) {
this.props[propName] = changes[propName].currentValue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment