Now, just as before, I also want to show you
this revalidation in production so to say.
So again, we're going to execute this built script here.
Now that we did add revalidate
to our getStaticProps return object.
And keep in mind that we have
this console log statement in here.
So now if I run npm run build,
again this entire project is prepared for production
and next JS goes ahead and pre-renders pages.
But it will now also do this
Incremental Static Generation here.
And if we scroll up a bit,
what do we indeed see is that
we're generating static pages here
as part of the build process,
and that was done before as well.
We therefore see our
regenerating console log statement here.
But then, you also see that this option here
is checked for ISR,
which stands for Incremental Static Regeneration.
And here we see that 10 seconds is locked in.
So basically next JS recognized that we set this
to 10 seconds here,
and hence it is aware dead this page slash nothing.
So the starting page, the index page
should be regenerated every 10 seconds.
That's what it's saying here.
So it's aware of that.
Now we can run our built website here locally
on our machine with npm start.
So not npm run dev,
that would start the development server
with better debugging support and so on.
But with npm start
we can run this build production ready site.
So after npm run build,
we can run npm start to view this production ready site
on our local machine.
So now I started is prepared page.
And if we now visit local host 3000 in the browser,
because that production demo's server here
still runs on local host 3000, as you see here.
If we visit that we see our product data here.
So we see this pre-rendered page,
which makes sense because it was pre-rendered
as part of the build process.
But if I now reload this page here,
you see regenerating here in this log, in this terminal.
And keep in mind that this terminal
represents the server side,
because here I started the server with npm start.
So what we see here is output from the code
that runs on the server.
And since we see regenerating here,
after we build our project with npm run build.
This proves that indeed getStaticProps was executed again
on the server which is running our production ready site.
So exactly what I explained over and over again,
over the last lectures, you see it in action here.
This getStaticProps function did run again on the server,
not in the browser
and not during the build process,
but on the server,
after it was deployed so to say
with npm start.
And therefore we see this was revalidated.
It was rebuilt because of our 10 seconds as setting.
Now I talked more than 10 seconds.
So if I reload this again,
we again see regenerating.
If I quickly reload again, a couple of times though
we don't see 10 times regenerating here though,
because I was below those 10 seconds.
So I hope this all makes sense.
And it's clear how that works.