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

185
Vistas
Trying to send props value once only in react JS

I have make a slider using carousel at Trip.js and in Home.Js I have created a review section by my self using useEffect and Everytime the slide changes it return values of pros which I have send on Trip.js component from Home.js, How to render the props value for once only.

import React, { useRef, memo } from "react";
import Carousel from "react-elastic-carousel";
import Item from "./Item";
import { items } from "./data";
import "./css/home.css";
import { Link } from "react-router-dom";
const Trip = (check) => {
const breakPoints = check.c;
console.log(breakPoints);
const carouselRef = useRef(null);
const onNextStart = (currentItem, nextItem) => {
if (currentItem.index === nextItem.index) {
carouselRef.current.goTo(0);
}
};
const onPrevStart = (currentItem, nextItem) => {
if (currentItem.index === nextItem.index) {
carouselRef.current.goTo(items.length);
}
};
return (
<div className="container">
<Carousel
className="carousel-university"
breakPoints={breakPoints}
ref={carouselRef}
onPrevStart={onPrevStart}
onNextStart={onNextStart}
disableArrowsOnEnd={false}
autoPlaySpeed={10000}
enableAutoPlay
pagination={false}
>
{items.map((item, index) => (
<Link to={`/trip/${item.title}`}>
<div key={item.id}>
<Item>
<img src={item.image} className="trip-img" alt={item.title} />
</Item>
<div className="trip-items-col">
<h3 className="trip-title">{item.title}</h3>
<p className="trip-date">{item.starton}</p>
</div>
</div>
</Link>
))}
</Carousel>
</div>
);
};
export default memo(Trip);

enter image description here

enter image description here

enter image description here

Calling Trip Component in Home.js Component

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