Created
June 28, 2018 15:27
-
-
Save wwwhatley/a02d2ed674fd97573580c549ef390e25 to your computer and use it in GitHub Desktop.
Example
This file contains hidden or 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 Greeting extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
name: "", | |
}; | |
} | |
componentDidMount() { | |
// AJAX | |
this.setState(() => { | |
return { | |
name: "William", | |
}; | |
}); | |
} | |
render() { | |
return ( | |
<div> | |
<h1>Hello! {this.state.name}</h1> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment