Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

327
Visualizações
When creating a new object with forEach, some prperties show up as $$typeof: Symbol(react.element) React

So I am receiving an array of Objects, each one has a "attributes.seller" property. Then I am using a forEach( ) to go over each one and create a new object with only the properties I need and pushing them to a new array, including the Seller property. The issue is that on ALL the received objects the "Seller" property exists and its a string.

However, after constructing the new object most of the seller properties show as "seller: {$$typeof: Symbol(react.element), type: 'button', key: null, ref: null, props: {…}, …}"

BUT not all of them, some do show correctly. So IDK whatI am doing wrong if my code was working before and it still works but not for all the items.

This is the object array i am receiving

This is where I itirate over each object:

createdResults.forEach((item) => {
      console.log(item.attributes.seller);
      const offer = {
        itemId: Number(item.attributes.itemId),
        token: item.attributes.token,
        amount: item.attributes.amount,
        price: item.attributes.price,
        seller: item.attributes.seller,
      };
      createdArr.push(offer);

Even when I log out to the console items.attributes.itemId, it shows EVERY SINGLE property just fine.

The issue is after I have pushed each new object into the new array that the "seller" property of it shows like this: New Object

 const getEvents = async () => {
    let createdArr = [];
    
    const created = new Moralis.Query("SaleCreateddd");
    

    const createdResults = await created.find();
    
    

    createdResults.map((item) => {
      // Until here, the seller string shows up correctly for each item
      console.log(item.attributes.seller);
      const offer = {
        itemId: Number(item.attributes.itemId),
        token: item.attributes.token,
        amount: item.attributes.amount,
        price: item.attributes.price,
        seller: item.attributes.seller,
      };
      // Its after the forEach loop that the seller property gets distorted

      createdArr.push(offer);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

itemId is already an integer remove Number()

then you are forgetting .seller

createdResults.forEach((item) => {
      console.log(item.attributes.seller);
      const offer = {
        itemId: item.attributes.seller.Number(itemId),
        token: item.attributes.seller.token,
        amount: item.attributes.seller.amount,
        price: item.attributes.seller.price,
        seller: item.attributes.seller.seller,
      };
      createdArr.push(offer);```
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda