Skip to content

Instantly share code, notes, and snippets.

View yuhanx0728's full-sized avatar
🌮

Yuhan Xiao yuhanx0728

🌮
View GitHub Profile
@yuhanx0728
yuhanx0728 / test.js
Last active December 16, 2020 02:19
Use map() with Promise - Promise.all(); also notice the use of Object.assign() here
// https://www.smashingmagazine.com/2018/01/graphql-primer-new-api-part-1/
const getPostWithAuthor = postId => {
return getPost(postId)
.then(post => getAuthor(post.author))
.then(author => {
return Object.assign({}, post, { author })
})
};
const getHomePageData = () => {