var Beacon = React.createClass({ getInitialState: function() { return {ridEdit: false, uuidEdit: false, majorEdit: false, minorEdit: false}; }, handleRemoveButton: function() { this.props.removeBeacon(this.props.beacon); }, handleRidClicked: function() { this.replaceState({ridEdit: true}); }, handleUuidClicked: function() { this.replaceState({uuidEdit: true}); }, handleMajorClicked: function() { this.replaceState({majorEdit: true}); }, handleMinorClicked: function() { this.replaceState({minorEdit: true}); }, handleKeyDownRid: function(evt) { if (evt.keyCode == 13 ) { var beacon = this.props.beacon; this.props.removeBeacon(beacon); beacon.rid = this.refs.rid.getDOMNode().value.trim(); this.props.addBeacon(beacon); } }, handleKeyDownUuid: function(evt) { if (evt.keyCode == 13 ) { var beacon = this.props.beacon; this.props.removeBeacon(beacon); beacon.uuid = this.refs.uuid.getDOMNode().value.trim(); this.props.addBeacon(beacon); } }, handleKeyDownMajor: function(evt) { if (evt.keyCode == 13 ) { var beacon = this.props.beacon; this.props.removeBeacon(beacon); beacon.major = this.refs.major.getDOMNode().value.trim(); this.props.addBeacon(beacon); } }, handleKeyDownMinor: function(evt) { if (evt.keyCode == 13 ) { var beacon = this.props.beacon; this.props.removeBeacon(beacon); beacon.minor = this.refs.minor.getDOMNode().value.trim(); this.props.addBeacon(beacon); } }, render: function() { var b = {}; if(this.state.ridEdit) b.rid = ; else b.rid = this.props.beacon.rid; if(this.state.uuidEdit) b.uuid = ; else b.uuid = this.props.beacon.uuid; if(this.state.majorEdit) b.major = ; else b.major = this.props.beacon.major; if(this.state.minorEdit) b.minor = ; else b.minor = this.props.beacon.minor; if(this.state.ridEdit || this.state.uuidEdit || this.state.majorEdit || this.state.minorEdit) add = "add"; else add = ""; return (