Ed

Often you need to make API calls in sequence where each depends on the previous result. Let's fetch user data, then their posts.

Your Task:

  • fetchUser(id) and fetchPosts(userId) are provided
  • Create an async function getUserWithPosts(id)
  • First await the user, then await their posts
  • Return an object: { user, posts }
  • Handle the async flow properly with async/await
TypeScript Solution
Loading...

Submit your code to see test results