Hello everyone. I am trying to make a simple react component that has a button that changes one word into another when pressed.
However my code is failing, and I don’t know why.
Thanks in advance.
<script>
class Funny extends React.Component {
state = {
word: 'Love'
}
handleClick = (e) => {
this.setState ({
word: 'Burn'
})
}
render () {
return (
<div className="test">
<button OnClick={this.handleClick}>'Dont do it bro.'</button>
<p> {this.state.word} the puppies </p>
</div>
)
}
}
ReactDOM.render(<Funny />, document.getElementById('Funny'));
</script>