Skip to content

Commit b2534c7

Browse files
committed
Update component to use componentDidUpdate
1 parent ddc52da commit b2534c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ class TimerWrapper extends Component {
3838
}
3939
}
4040

41-
componentWillReceiveProps(nextProps) {
41+
componentDidUpdate(prevProps) {
4242
const {
4343
active,
4444
duration,
4545
time,
4646
onStart,
4747
onStop,
48-
} = nextProps;
48+
} = this.props;
4949

50-
if (active === this.props.active && time !== this.props.time && time !== this.state.time) {
50+
if (prevProps.active === active && prevProps.time !== time && time !== this.state.time) {
5151
const timeDiff = this.state.time - time;
5252

5353
this.setState({
@@ -57,7 +57,7 @@ class TimerWrapper extends Component {
5757
return;
5858
}
5959

60-
if (active !== this.props.active) {
60+
if (prevProps.active !== active) {
6161
switch (active) {
6262
case true:
6363
const nextTime = duration !== null && this.state.time >= duration

0 commit comments

Comments
 (0)