//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]; }
//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];
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps