#my route is not static only if i use a

1 messages · Page 1 of 1 (latest)

sacred river
hearty belfryBOT
#

Hi @sacred river. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

sacred river
#

The communication barrier is hard.

hearty belfryBOT
#

Sorry @sacred river, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:

Perhaps try again in 15mins?

sacred river
#

Its as simple as this

#

dynamic = "page is rendered on every request"

#

static = "page is rendered and then stored in a cache for later requests"

#

generateStaticParams makes the rendering static, and builds stuff at build time so its already made.

#

if you dynamicParams = true (which is default) it allows stuff to be built even if its not in genereateStaticParams

#

but after initial request its just going to start giving the cache

#

dynamic will always mean the page is rendered at request time

#

so you cant have some be dynamic and some be static

#

the route itself has a dynamic parameter yes

#

but the route itself IS dynamic or static

#

but you can have ISR or ODR with static

rugged perch
#

Oh okay. I understand. Thank you

#

Can I just write an example to be sure ?

sacred river
#

yea

rugged perch
#
import React from "react";

export const generateStaticParams = async () => {
  return [
    { slug: 'a' },
    { slug: 'b' },
  ]
};

const MovieIdPage = async ({ params }) => {
  const response = await fetch("something");
  return (
    <div>
    </div>
  );
};

export default MovieIdPage;
#

Here, at build time, I will have 2 pages rendered as static

sacred river
#

yes

rugged perch
#

For the others, on first request, they will be rendered at build time

#

after this, they will be static as the fetch keep cache

sacred river
#

build time is literally

#

when you build

#

its when you first start your project

rugged perch
#

yes

sacred river
#

your terminology is messing you up

rugged perch
#

npm run build yes

sacred river
#

build -> /a /b html is rendered and stored

#

runtime -> /c /d html is created on first request and stored

rugged perch
#

Ok I understand.

#

Even I use here prisma for example instead of fetch, /c and /d will not change because I don't have define ISR or ODR.

#

Thank you for your help I didn't understand that with the docs

sacred river
#

yes

#

np

#

its hard to understand static/dynamic with also how fetch caching works

rugged perch
#

yes exactly

#

because when you make this example you don't know really if your page doesn't change because of fetch or because of rendering

sacred river
#

yeah

#

its difficult for sure lol

rugged perch
#

I took notes of the documentations few days ago and I wrote => dynamic is only rendered at runtime and static only on build time. It was false lol

#

Is english language your native one ?

sacred river
#

yes, and i mean what your saying is is kinda true still

#

dynamic is true statement

#

static is semi-true, just need to make a amendment lol

rugged perch
#

yes, depends on what you did with generateStaticParams lol

#

thank you to took all this time for me, really

sacred river
#

yw

rugged perch
sacred river
#

Hmm I’m not sure