Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Addgrocery extends React.Component{
- constructor(props) {
- super(props);
- this.state = {
- count : 0;
- }
- }
- addgrcy =() => {
- this.setState({
- number: this.state.number +1
- });
- }
- render(){
- return (
- <div>
- <h1>counter</h1>
- <div>{this.state.count}</div>
- <button onClick={this.addgrcy}>+</button>
- </div>
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement