1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-13 08:02:38 +03:00

Remove React warning

Fire onOptionChange in componentWillMount, otherwise end up trying
to update state effectively in a render method, which is bad.
This commit is contained in:
David Baker
2017-03-29 15:05:49 +01:00
parent 6f4b080934
commit e139f5212a

View File

@@ -43,8 +43,10 @@ export default class CountryDropdown extends React.Component {
this.state = { this.state = {
searchQuery: '', searchQuery: '',
} }
}
if (!props.value) { componentWillMount() {
if (!this.props.value) {
// If no value is given, we start with the first // If no value is given, we start with the first
// country selected, but our parent component // country selected, but our parent component
// doesn't know this, therefore we do this. // doesn't know this, therefore we do this.