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

121
Vistas
How to make image clickable and redirect to its introduction value page in Reactjs

I have called an api then pick let says drinks. i picked drink name and images. Now i need to find the details about that drink.On clicking in this image it show about that . which all these think are present in the api. But i dont know how to do it.

import React from "react";


const DrinkList = (props) => {

  // const handleTextShow
  return (
    <>
      {props.drinks.map((drink, index) => (
        <div>
          <img
            src={drink.strDrinkThumb}
            alt="drink"
            width="300"
            height="300"
            onClick={handleTextShow}
          ></img>
        </div>
      ))}
    </>
  );
};

export default DrinkList;

strDrinkThumb shows photo about that and details be strDetails.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Just pass strDetails to your handleTextShow function

const DrinkList = (props) => {

    const handleTextShow = (drinkDetail) => {
        console.log(drinkDetail)
    }
    return (
        <>
        {props.drinks.map((drink, index) => (
            <div>
                <img
                    src={drink.strDrinkThumb}
                    alt="drink"
                    width="300"
                    height="300"
                    onClick={() => handleTextShow(drink.strDetails)}
            ></img>
            </div>
        ))}
        </>
    );
};

export default DrinkList;
about 4 years ago · Juan Pablo Isaza Denunciar
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