Last active
March 24, 2019 17:36
-
-
Save alexandrzavalii/296b2d9b51e3be21deed944112866847 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
class Dumbo extends React.Component { | |
// static getDerivedStateFromProps(nextProps, prevState){ return prevState; } | |
state = { clothing : 'hat' }; | |
// componentDidMount() { } | |
// shouldComponentUpdate() { } | |
// getSnapshotBeforeUpdate() { } | |
// componentWillUnmount() { } | |
handleState = () => this.setState({clothing: 'shoes'}); | |
render() { | |
return( | |
<> | |
<h1>Hey, my name is Dumbo. </h1> | |
<p>I am wearing {this.state.clothing} today.</p> | |
<button onClick={this.handleState}>put on shoes instead </button> | |
</> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment