import ".css"
.red {
font-size: 25px;
background-color: red;
color: white;
}
import React from 'react'
import btn from './styles.css'
export default class CoolButton extends React.Component {
render() {
return (
<button className={btn.red}>{this.props.text}</button>
)
}
}
this.handleClick() {
var element = getElementsByClassName('')
element.setAttribute('background-color ', 'red');
}
constructor() {
super();
this.state = {
flag:false,
}
}
this.handleClick() {
this.setState({
flag:true
})
}
render() {
return (
<div className="wrapper">
<div className="block" backgroundColor={this.state.flag === true ? 'red': 'blue'}>
<input type="radio" onClick={ this.handleClick } />
</div>
</div>
);
}