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

173
Views
revalidar en getStaticProps parece no funcionar como se esperaba

Intento revalidar los datos usando getStaticProps en Next js cada 3 segundos, pero parece que no funciona como se esperaba, los datos no se revalidan después de 3 segundos.

Este es mi código:

 export const getStaticProps = async () => { console.log("Hello") let error = false let data = [] try{ const response = await axios.get('https://some-service/events') for(const key in response.data){ const resData = response.data[key] data.push({id: key, ...resData}) } }catch(e){ console.log(e) error = true }finally{ return { props: { data, error }, revalidate: 3 } } }

Estoy ejecutando localhost usando

npm ejecutar compilar && npm ejecutar iniciar

también, intente usar:

npm ejecutar dev

Este es mi código de componente:

 function HomePage(props) { return ( <div> <EventList items={props.data} /> </div> ); } export default HomePage;

Gracias por adelantado

about 4 years ago · Juan Pablo Isaza
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!