Remix Utils - v9.0.0
    Preparing search index...

    Function promiseHash

    • Get a hash of promises and await them all. Then return the same hash with the resolved values.

      Type Parameters

      • Hash extends object

      Parameters

      Returns Promise<AwaitedPromiseHash<Hash>>

      export async function loader({ request }: Route.LoaderArgs) {
      return json(
      promiseHash({
      user: getUser(request),
      posts: getPosts(request),
      })
      );
      }
      export async function loader({ request }: Route.LoaderArgs) {
      return json(
      promiseHash({
      user: getUser(request),
      posts: promiseHash({
      list: getPosts(request),
      comments: promiseHash({
      list: getComments(request),
      likes: getLikes(request),
      }),
      }),
      })
      );
      }