Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
Loading and rendering an image in react with a passed image url through props

I have a react component that is mean to render an image. Withing the functional component, I am passing in the images relative path from the file. I want to simple render the image in the url browser. I did read that I should be using require. When I try to render it, it shows that the image is not there and the empty image icon. I am not sure what else to do. here is my component.

import React from 'react'

export default function PropertyImage({ image }) {
  console.log(image)
  return (
    <div>
      <img src={require(image)}/>
    </div>
  )
}

I have also tried:


export default function PropertyImage({ image }) {
  console.log(image)
  return (
    <div>
      <img src={image}/>
    </div>
  )
}

This is the relative path that I have which is what image shows in the console.log:

../images/unnamed.jpeg

Here is the file structure.

File Structure

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda