Next.js Discord

Discord Forum

NextJS 13: How I can check if a route dynamic or static?

Unanswered
Ojos Azules posted this in #help-forum
Open in Discord
Avatar
Ojos AzulesOP
I'm experimenting with how to make some routes static and I have a question - is there an easy way to determine if this route is static or dynamic?

3 Replies

Avatar
Alfonsus Ardani
No, there isn't a way to check if a route is static or dynamic without looking at the code and checking every route segment
Do note that the staticity of a route is determined per route not per segment
Avatar
Ojos AzulesOP
I found that you can use export variables to control the static route: export const dynamic = 'error'
So if I use revalidate: 0 I get an error "Error: Page with dynamic = "error" encountered dynamic data method"