There could be multiple ways to do it. One being, via use of
state
to play with style.
Example:
class Test extends React.Component {
constructor(){
super();
this.state = {
red: true
}
}
changeColor(){
this.setState({red: !this.state.red})
}
render(){
let btn_class = this.state.red ? "redButton" : "blackButton";
return (
<button className={btn_class} onClick={this.changeColor.bind(this)}>
Button
</button>
)
}
}
React.render(<Test />, document.getElementById('container'));