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

180
Visualizações
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 à 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