Browse Source

Fixed small error in example

main
Brian Vaughn 7 years ago
parent
commit
858c1a7511
  1. 6
      examples/update-on-async-rendering/adding-event-listeners-after-continued.js

6
examples/update-on-async-rendering/adding-event-listeners-after-continued.js

@ -10,12 +10,14 @@ class ExampleComponent extends React.Component {
this.finalizeSubscription();
}
// highlight-line
// highlight-range{1-9}
// highlight-range{1-11}
componentDidUpdate(prevProps, prevState) {
if (this.props.dataSource !== prevProps.dataSource) {
// Similar to adding subscriptions,
// It's only safe to unsubscribe during the commit phase.
prevProps.dataSource.dispose();
prevProps.dataSource.unsubscribe(
this.handleSubscriptionChange
);
this.finalizeSubscription();
}

Loading…
Cancel
Save