Skip to content

Commit

Permalink
Fix currentValue calculation (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpanchuk authored and kay-is committed May 21, 2017
1 parent 33b662d commit 9e3bae1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions 12-component-refactor.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@
componentDidMount() {
var component = this
var props = this.props
var state = this.state

this.interval = setInterval(function() {
var currentRoom = state.currentRoom < props.rooms.length
? state.currentRoom + 1
var currentRoom = component.state.currentRoom < props.rooms.length - 1
? component.state.currentRoom + 1
: 0
component.setState({currentRoom: currentRoom})
}, 1000)
Expand Down

0 comments on commit 9e3bae1

Please sign in to comment.