state={bank:bankOne};
handleButtonClick=()=>{
let button=document.getElementById('button');
button.style.backgroundColor==='lightcoral'?button.style.backgroundColor='lightgreen':
button.style.backgroundColor='lightcoral';
this.state.bank===bankOne? this.setState({bank:bankTwo}):
this.setState({bank:bankOne});
}
Is this a javascript challenge?
yes. It is. It’s a react question.
The style does not change for the first click as well. Everything works fines from the second, both the state and the style.