Created
October 29, 2017 15:02
-
-
Save Nahiduzzaman/da35b5ed9f4c027c4b27b3c8d746389a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
count: 0 | |
} | |
} | |
incrementCount(){ | |
debugger | |
this.setState({ | |
count: this.state.count + 1 | |
}); | |
} | |
decrementCount(){ | |
this.setState({ | |
count: this.state.count - 1 | |
}); | |
} | |
render() { | |
return ( | |
<div className="counter"> | |
<h1>{this.state.count}</h1> | |
<button className="btn" onClick={()=>this.incrementCount()}>Increment</button> | |
<button className="btn" onClick={()=>this.decrementCount()}>Decrement</button> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment