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

255
Visualizações
Error: Failed to obtain image address when using props and creating dynamic routes

So I am trying to dynamically render a component with its properties when I click on a button on another page with dynamic routes. My route path is:

<Route path="/prod/:id/:descr/:price/:image"><MakePurchase /></Route>

then I set up a link also as follows:

<Link to={"/prod/"+product.id+"/"+product.descr+"/"+product.price+""+product.image}>

In the component I want to render looks like this:

    return(
<>
...
<img src={props.match.params.image} alt=""/>
...
<h2>{props.match.params.descr}</h2>
<h3>Price: <span >&#8358;</span>{props.match.params.price}</h3>
...
</>
)
}

the values for price and descr are returned perfectly but for image, there is no image displayed. I did a console.error(props) which returns values like this

isExact: false
params:
descr: "PS5 Dual Sense Wireless Controller"
id: "300"
image: "static"
price: "25000" 

Please, how do I get the correct path for my image and display the image on the page?

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