Skip to content

Instantly share code, notes, and snippets.

@radix
Created June 2, 2017 20:37
Show Gist options
  • Save radix/42eb85c686e222fa68a272592ba8c7b2 to your computer and use it in GitHub Desktop.
Save radix/42eb85c686e222fa68a272592ba8c7b2 to your computer and use it in GitHub Desktop.
let scene = this.props.currentScene;
let sceneButton;
if (scene && players[pid].scene !== scene) {
sceneButton = <button onClick={() => {this.props.onAddToScene(pid, scene)}}>Add to scene</button>;
} else {
sceneButton = <button onClick={() => this.props.onRemoveFromScene(pid)}>Remove</button>;
}
@radix
Copy link
Author

radix commented Jun 2, 2017

This fixes it:

        if (this.props.currentScene && players[pid].scene !== this.props.currentScene) {
          let scene = this.props.currentScene;
          sceneButton = <button onClick={() => {this.props.onAddToScene(pid, scene)}}>Add to scene</button>;
        } else {
          sceneButton = <button onClick={() => this.props.onRemoveFromScene(pid)}>Remove</button>;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment