Skip to content

Commit 2b9550f

Browse files
committed
Use single setState call instead of two
1 parent 94bb677 commit 2b9550f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/containers/recording-step.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ class RecordingStep extends React.Component {
4444
alert(this.props.intl.formatMessage(messages.alertMsg)); // eslint-disable-line no-alert
4545
}
4646
handleLevelUpdate (level) {
47-
this.setState({level});
48-
if (this.props.recording) {
49-
this.setState({levels: (this.state.levels || []).concat([level])});
50-
}
47+
this.setState({
48+
level: level,
49+
levels: this.props.recording ? (this.state.levels || []).concat([level]) : this.state.levels
50+
});
5151
}
5252
handleRecord () {
5353
this.audioRecorder.startRecording();

0 commit comments

Comments
 (0)