mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 04:33:10 +00:00
18 lines
317 B
JavaScript
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
|
|
);
|
|
}
|
|
}
|
|
}
|