Skip to content

Instantly share code, notes, and snippets.

@wwwhatley
Last active June 28, 2018 15:41
Show Gist options
  • Save wwwhatley/bb117114d081e062782af7da0c713a5c to your computer and use it in GitHub Desktop.
Save wwwhatley/bb117114d081e062782af7da0c713a5c to your computer and use it in GitHub Desktop.
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