'Is it possible to remember last value of Next.js ISR?

I have an ISR flow in Next.js web applictions which uses validation value of 100 seconds.

export async function getStaticProps() {
  const value = previousValue + 5;

  return {
    props: {
      value,
    },
    revalidate: 100,
  }
}

Is it possible to initiate the value with 0 value, and each iteration of the validation, to increase the value by the latest value?

So basically, in zero time it starts with 0. Then each iterations updates with 5. For example after 1000 seconds value would be 5*10.

Is there a way to do so with ISR?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source