How to display item when query is ready

Hi @carlosgalvarez ,

@mhammouz has a point. The flow is:

  1. Hide the text on load in Properties panel that appears when the text component is selected. If you don’t see the panel, it’s probably hidden. You can enable it in Editor menu: Tools → Developer Tools → Properties Panel.

  2. In your code, query your collection (as I understand, you’re getting the user by its username), get the first matching user item, and use the name property of the item to form the text. Then show the hidden text.

import wixData from "wix-data";

$w.onReady(async () => {
  const username = "john";
  const {
    items: [user]
  } = await wixData
    .query("Users")
    .eq("username", username)
    .find();

  const welcomeText = $w("#welcomeText");
  welcomeText.text = `Hola ${user.name}`;
  welcomeText.show();
});