Browse Source

Added gDSFP to example

main
Brian Vaughn 7 years ago
parent
commit
98d5a092af
  1. 12
      examples/update-on-async-rendering/adding-event-listeners-after-continued.js

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

@ -5,6 +5,18 @@ class ExampleComponent extends React.Component {
subscribedValue: this.props.dataSource.value,
};
// highlight-line
// highlight-range{1-10}
static getDerivedStateFromProps(nextProps, prevState) {
if (
prevState.subscribedValue !==
nextProps.dataSource.value
) {
return {
subscribedValue: nextProps.dataSource.value,
};
}
}
// highlight-line
// highlight-range{1-3}
componentDidMount() {
this.finalizeSubscription();

Loading…
Cancel
Save