dynamic route with client side rendering
Answered
Cão Fila de São Miguel posted this in #help-forum
Cão Fila de São MiguelOP
Is it possible to implement dynamic route in next.js with client side rendering
Answered by Plott Hound
Try this the dynamic routes:
export const dynamic = 'force-static'
export const dynamic = 'force-static'
13 Replies
Cão Fila de São MiguelOP
I want to load it statically but in my build it is Dynamic
Route (app) Size First Load JS
┌ ○ / 55.9 kB 242 kB
├ ○ /_not-found 0 B 0 B
├ ○ /home 47.9 kB 280 kB
├ λ /games/[slug] 8.54 kB 207 kB
└ λ /groups/[id] 10.5 kB 231 kB
+ First Load JS shared by all 95.7 kB
├ chunks/607-b94e279423cc8c9c.js 11.3 kB
├ chunks/69-48da2e2a9ab30978.js 29 kB
├ chunks/fd9d1056-b385985c66e965ea.js 53.4 kB
â”” other shared chunks (total) 2.04 kB
â—‹ (Static) prerendered as static content
λ (Dynamic) server-rendered on demand using Node.jsPlott Hound
Try this the dynamic routes:
export const dynamic = 'force-static'
export const dynamic = 'force-static'
Answer
Plott Hound
Do you want to statically render all of the pages within the dynamic routes?
If so you’d want to use this https://nextjs.org/docs/app/api-reference/functions/generate-static-params
Cão Fila de São MiguelOP
I think this approach falls into ISR
@Cão Fila de São Miguel I think this approach falls into ISR
no,
export const dynamic = 'force-static' works actually, try itat least for this
import { Content } from "./content";
export const dynamic = "force-static";
export default function Page() {
return <Content />;
}
"use client";
import { useParams } from "next/navigation";
export function Content() {
const params = useParams();
return <div>{JSON.stringify(params.slug)}</div>;
}Cão Fila de São MiguelOP
got it
thanks
Also can you help me with
generate-static-params for dynamic routes, i want to have slug folder.i am getting slug from url not from api, Prevoius we would have to these configs in
next.config.js now things are changed with app router.@Cão Fila de São Miguel Also can you help me with `generate-static-params` for dynamic routes, i want to have slug folder.
open new post, thats a different question
Cão Fila de São MiguelOP
Sure, Thank you