File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -3,20 +3,22 @@ import { notFound } from "next/navigation";
33import ProjectPage from "@/components/project-page" ;
44import { projects } from "@/components/projects" ;
55
6- export default async function ProjectRoute ( {
6+ // ① Generamos estáticamente todas las rutas /proyectos/<id>
7+ export function generateStaticParams ( ) {
8+ return projects . map ( ( project ) => ( {
9+ id : project . id ,
10+ } ) ) ;
11+ }
12+
13+ // ② Página para cada proyecto
14+ export default function ProjectRoute ( {
715 params,
816} : {
9- params : Promise < { id : string } > ;
17+ params : { id : string } ;
1018} ) {
11- // 1️⃣ Esperamos a que Next.js resuelva los params
12- const { id } = await params ;
13-
14- // 2️⃣ Buscamos el proyecto
15- const project = projects . find ( ( p ) => p . id === id ) ;
19+ const project = projects . find ( ( p ) => p . id === params . id ) ;
1620 if ( ! project ) {
1721 return notFound ( ) ;
1822 }
19-
20- // 3️⃣ Devolvemos la UI
2123 return < ProjectPage project = { project } /> ;
2224}
You can’t perform that action at this time.
0 commit comments