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

140
Views
¿Cómo soluciono otros datos que no se agregan a los datos anteriores en el desplazamiento infinito de reacción?

Esta es la primera vez que implemento el desplazamiento infinito de reacción. Me encontré con dificultades donde la matriz inicial de datos sigue repitiéndose.

 function Details() { const [facility, setFacility] = useState([]); const [loading, setLoading] = useState(true); const getFacility = useCallback(async () => { let skip = 0; setLoading(true) await Axios.get( `...apiUrl/${wardTitle}/ward/details?limit=${10}&skip=${skip}` ).then((response) => { const details = response.data.data; setFacility((prev) => [...prev, ...details]); setLoading(false) }); }, [wardTitle]); const handleScroll = (e) => { const { scrollTop, scrollHeight, clientHeight} = e.currentTarget; if(clientHeight + scrollTop + 1 >= scrollHeight ){ getFacility(); } }; useEffect(() => { getFacility(); }, [getFacility]); return ( <> {facility.map((cur) => ( <div>{curr}</div> {loading && <h4>Loading ...</h4> ) </> ) }

Todo parece estar bien aparte de la repetición de datos. No sé dónde me equivoqué en la llamada. Apreciaría cualquier ayuda.

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

0

Puedo ver tantos errores en su código, verifique la ortografía también. ¿No estás explicando lo que realmente quieres hacer? desplazamiento infinito como facebook?

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!