Skip to content

Commit 00a7531

Browse files
committed
Initialilzed clock when component receive prop too
If you want restart clock but it is yet mounted it did't work.
1 parent f8cd043 commit 00a7531

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

coffee/react-countdown-clock.coffee

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ module.exports = React.createClass
2323
seconds: @props.seconds
2424

2525
componentWillReceiveProps: (props) ->
26-
@setState seconds: props.seconds
27-
28-
componentWillMount: ->
2926
@_setScale()
27+
@_setupCanvas()
28+
@_drawTimer()
29+
@_startTimer()
30+
@setState seconds: props.seconds
3031

3132
componentDidMount: ->
32-
@_setupCanvas() if !_canvas
33+
@_setScale()
34+
@_setupCanvas()
3335
@_drawTimer()
3436
@_startTimer()
3537

0 commit comments

Comments
 (0)