Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix currentValue calculation #5

Merged
merged 1 commit into from
May 21, 2017
Merged

Fix currentValue calculation #5

merged 1 commit into from
May 21, 2017

Conversation

alexpanchuk
Copy link
Contributor

  1. var state = this.state. state doesn't refer to component state after using setState, because it create new state-object with updated values.
var currentRoom = component.state.currentRoom < props.rooms.length
        ? component.state.currentRoom + 1
        : 0

currentRoom can be equal to props.rooms.length with this expression, error occurs with props.rooms[props.rooms.length]

@kay-is kay-is merged commit 9e3bae1 into kay-is:master May 21, 2017
@kay-is
Copy link
Owner

kay-is commented May 21, 2017

You're right. Thank you :)

sejas added a commit to reactspain/react-from-zero that referenced this pull request Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants