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

13 lines
288 B
JavaScript

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