//19. selectMenuChangeEventHandler //a. Dependencies: getUserPosts, refreshPosts //b. Should be an async function //c. Automatically receives the event as a parameter (see cheatsheet) //d. Defines userId = event.target.value || 1; (see cheatsheet) //e. Passes the userId parameter to await getUserPosts //f. Result is the posts JSON data //g. Passes the posts JSON data to await refreshPosts //h. Result is the refreshPostsArray //i. Return an array with the userId, posts and the array returned from refreshPosts: //[userId, posts, refreshPostsArray] This is what I have but it fails help please const selectMenuChangeEventHandler = async (e) => { let userId = e?.target?.value || 1; let posts = await getUserPosts(userId); let refreshPostsArray = await refreshPosts(posts); return [userId, posts, refreshPostsArray]; }

LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
5th Edition
ISBN:9781337569798
Author:ECKERT
Publisher:ECKERT
Chapter7: Working With The Bash Shell
Section: Chapter Questions
Problem 3RQ
icon
Related questions
Question

//19. selectMenuChangeEventHandler
//a. Dependencies: getUserPosts, refreshPosts
//b. Should be an async function
//c. Automatically receives the event as a parameter (see cheatsheet)
//d. Defines userId = event.target.value || 1; (see cheatsheet)
//e. Passes the userId parameter to await getUserPosts
//f. Result is the posts JSON data
//g. Passes the posts JSON data to await refreshPosts
//h. Result is the refreshPostsArray
//i. Return an array with the userId, posts and the array returned from refreshPosts:
//[userId, posts, refreshPostsArray]

This is what I have but it fails help please

const selectMenuChangeEventHandler = async (e) => {
    let userId = e?.target?.value || 1;
    let posts = await getUserPosts(userId);
    let refreshPostsArray = await refreshPosts(posts);
    return [userId, posts, refreshPostsArray];
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L