L
L
litash2017-07-17 17:21:10
css
litash, 2017-07-17 17:21:10

How to change element color on click ReactJS?

How to change the background-color of an element with class "block" when clicking on input type="radio"

class App extends React.Component {
  constructor() {
    super();
    
    this.state = {  }
    
    this.handleClick = this.handleClick.bind(this);
  }
  
  this.handleClick() {
    
  }
  
  render() {
    return (
      <div className="wrapper">
        <div className="block">
          <input type="radio" onClick={ this.handleClick } /> 
        </div>
      </div>
    );
  }
}

ReactDOM.render(
  <App />,
  document.getElementById('root')
);

https://codepen.io/litash/pen/gRyJQW

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexKeller, 2017-07-17
@litash

https://codepen.io/anon/pen/RgOzZj

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question