Skip to content

Instantly share code, notes, and snippets.

@masaeedu
Last active February 15, 2016 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masaeedu/c902624b224b6d252c5f to your computer and use it in GitHub Desktop.
Save masaeedu/c902624b224b6d252c5f to your computer and use it in GitHub Desktop.
componentWillMount() {
//fetch all dentist names
getAllDentists()
.then((results) => {
// Load reviews for all these dentists
for (dentist of results) {
getDentistReviews(dentist.id).then(response => {
this.setState(state => {
state[dentist.id] = response.reviews;
return state;
});
});
}
// Set state
this.setState({
dentists: results.data
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment