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

170
Views
revalidate in getStaticProps seem doesn't work as expected

I try to revalidate data using getStaticProps in Next js every 3 seconds, but it seems doesn't work as expected, data doesn't revalidate after 3 seconds.

This is my code:

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
    }
  }
}

I am running localhost using

npm run build && npm run start

also, try using:

npm run dev

This is my component code:

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

export default HomePage;

Thanks in advance

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!