The full error in the browser console in this
Uncaught TypeError: Cannot set property className of # which has only a getter
I am trying to put a class with Javascript everytime an action happens, this is the code
performClick (sideBet) {
switch (sideBet) {
case 'SuitEmUp':
document.getElementById('SuitEmUp').className = 'animated shake';
break;
case 'PerfectPairs':
document.getElementById('PerfectPairs').className = 'animated shake';
break;
default:
console.log('Sorry, we are out of ' + sideBet + '.');
}
}
and then changed that code to only this in my Reactjs app
performClick (sideBet) {
this.refs[sideBet].getDOMNode().className = 'animated shake';
}
and the same error comes up...
HTML
<div ref="sideBetsLeft">
<svg id="PerfectPairs" onClick={this.performClick.bind(this, 'PerfectPairs')}
ref="PerfectPairs" className="side-bet" viewBox={viewBoxVal}></svg>
<svg id="SuitEmUp" onClick={this.performClick.bind(this, 'SuitEmUp')}
ref="SuitEmUp" className="side-bet" viewBox={viewBoxVal}></svg>
</div>
So, I don't know what is going on here. Any suggestions?