Last active
February 15, 2016 23:12
-
-
Save masaeedu/c902624b224b6d252c5f 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
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