Files
react.dev/examples/update-on-async-rendering/invoking-external-callbacks-before.js
2018-02-07 09:21:26 -08:00

18 lines
317 B
JavaScript

// Before
class ExampleComponent extends React.Component {
// highlight-range{1-13}
componentWillUpdate(
nextProps,
nextState
) {
if (
this.state.someStatefulValue !==
nextState.someStatefulValue
) {
nextProps.onChange(
nextState.someStatefulValue
);
}
}
}