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

16 lines
269 B
JavaScript

// Before
class ExampleComponent extends React.Component {
// highlight-next-line
state = {};
// highlight-range{1-8}
componentWillMount() {
this.setState({
count: 0,
derivedValue: computeDerivedValue(
this.props
),
});
}
}