Get a hash of promises and await them all. Then return the same hash with the resolved values.
export async function loader({ request }: LoaderFunctionArgs) { return json( promiseHash({ user: getUser(request), posts: getPosts(request), }) );} Copy
export async function loader({ request }: LoaderFunctionArgs) { return json( promiseHash({ user: getUser(request), posts: getPosts(request), }) );}
export async function loader({ request }: LoaderFunctionArgs) { return json( promiseHash({ user: getUser(request), posts: promiseHash({ list: getPosts(request), comments: promiseHash({ list: getComments(request), likes: getLikes(request), }), }), }) );} Copy
export async function loader({ request }: LoaderFunctionArgs) { return json( promiseHash({ user: getUser(request), posts: promiseHash({ list: getPosts(request), comments: promiseHash({ list: getComments(request), likes: getLikes(request), }), }), }) );}
Get a hash of promises and await them all. Then return the same hash with the resolved values.