React
by aalok123
HTML
<div id="app"></div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
.activeClass{
color: green;
opacity: 1 ;
background-color:white;
}
.inactiveClass{
color: blue;
opacity: 0.6;
background-color: #ccc;
}
React
class TodoApp extends React.Component {
constructor(props) {
super(props)
this.state = {
}
}
render() {
return (
<div>
<h2>Todos:</h2>
<button id="mybtn" className={this.props.active ? 'activeClass' : 'inactiveClass'} >mybutton</button>
</div>
)
}
}
ReactDOM.render(<TodoApp />, document.querySelector("#app"))