Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
usó una API. importar y en componentes>DrinkList.js handleTextShow la función no se está ejecutando

En mi programa de reacción, hice un DrinkList.js en el que muestro las imágenes de la bebida. pero cuando empiezo, se puede hacer clic con Onclick y pasar una función para mostrar su nombre en la consola. el error comienza a inundar.

 import React from "react"; // import index from "./src" const DrinkList = (props) => { const handleTextShow = (drinkDetail) => { console.log(drinkDetail.strGlass); }; return ( <> {props.drinks.map((drink, index) => ( <div> <img src={drink.strDrinkThumb} alt="drink" width="300" height="300"> {/* hello */} onClick={() => handleTextShow(handleTextShow)} </img> {/* <h4> {drink.strInstructions} </h4> */} {/* <Details /> */} </div> ))} </> ); }; export default DrinkList;

decir strGlass es detalle strDrinkThumb es foto.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El problema es que, en la función handleTextShow, en lugar de pasar el nombre de la bebida para querer consolar, está pasando la función handleTextShow como argumento, para resolverlo, reemplace el argumento handleTextShow con el nombre de la bebida,

 onClick={() => handleTextShow(drink.name)}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!