Skip to content

Instantly share code, notes, and snippets.

@soyHouston256
Created November 3, 2020 13:43
Show Gist options
  • Save soyHouston256/f363e1b256d647768912d68343dfbb6e to your computer and use it in GitHub Desktop.
Save soyHouston256/f363e1b256d647768912d68343dfbb6e to your computer and use it in GitHub Desktop.
import React from 'react';
class Button extends React.Component {
state = {
count :0,
}
handleClick = ()=>{
this.setState({
count: this.state.count + 1,
})
}
render() {
const {count} = this.state
return (
<div>
<h1>Manzanas : {count}</h1>
<button type="button" onClick={this.handleClick}>Click</button>
</div>
)
}
}
export default Button
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment