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

188
Visualizações
base64 encoded On-chain NFT not displaying on the Fronted

I'm trying to display all the minted tokens on the front page of my dapp, so I created an array in solidity and pushed the tokenId to it, then tried using a spread operator, and mapping it to the tokenURI's. Unfortunately, I haven't been able to get the image to display it.

      for (let i = 1; i <= totalSupply; i++) { //this is listing an array of minted tokens
        const tokenURI = await contract.methods.tokenURI(i - 1).call()
        const imageURI = await tokenURI.image
        // how should we handle the state on the front end
        this.setState({
          NFTz: [...this.state.NFTz, imageURI] // spread operator
        }) // pretty sure the array could be done on the front end

      }
      console.log(this.state.imageURI)
      console.log(this.state.NFTz)

The console returns:

index.js:1437 Warning: Each child in a list should have a unique "key" prop.

Check the render method of `App`. See fb.me/react-warning-keys for more information.
    in div (at App.js:136)
    in App (at src/index.js:7)

It's rendered it onto MDBcards with:

<div className="row textCenter">
            {this.state.NFTz.map((key, imageURI) => {
              return (
                <div>
                  <div>
                    <MDBCard className="token img" style={{ maxWidth: '22rem' }}>
                      <MDBCardImage src={imageURI} position='top' height='250rem' style={{ marginRight: '4px' }} />
                      <MDBCardBody>
                        <MDBCardTitle></MDBCardTitle>
                        <MDBCardText></MDBCardText>
                        <MDBBtn href={imageURI}>Download</MDBBtn>
                      </MDBCardBody>
                    </MDBCard>
                  </div>
                </div>

PS: Err, probably more efficient to create an array on the front end, instead of in solidity.

Thank you and God Bless

about 4 years ago · Juan Pablo Isaza
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