Last active
June 28, 2018 15:41
-
-
Save wwwhatley/bb117114d081e062782af7da0c713a5c to your computer and use it in GitHub Desktop.
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
const GreetingCard = (props) => { | |
return ( | |
<div> | |
<h1>{props.name}</h1> | |
</div> | |
) | |
} | |
class Greeting extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
name: "", | |
}; | |
} | |
componentDidMount() { | |
// AJAX | |
this.setState(() => { | |
return { | |
name: "William", | |
}; | |
}); | |
} | |
render() { | |
return ( | |
<div> | |
<GreetingCard name={this.state.name} /> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment