React

by luka kupunia

HTML

<div id="root"></div>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#root {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
}

li {
  margin: 8px 0;
}

h2 {
  font-weight: bold;
  margin-bottom: 15px;
}

.done {
  color: rgba(0, 0, 0, 0.3);
  text-decoration: line-through;
}

input {
  margin-right: 5px;
}

React

const a = document.getElementById('root');
class Demo extends React.Component {
	state = {
   count : 0
  };
	render(){
  	return(
    	<div>
    	  <h1>{this.Mycount()}</h1>
        <button>Hii</button>
    	</div>
    )
  }
  Mycount(){
  	const {count} = this.state;
  	return this.state.count === 0 ? 'zero' : this.state.count; 
  }
}
ReactDOM.render(<Demo />, a);