You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: `Rent a car - Car ${params.carId} details`,
214
-
};
245
+
const CarPage = async (props: Props) => {
246
+
const params = await props.params;
247
+
+ const car = await api.getCar(params.carId);
248
+
+ console.log('Car page', car);
249
+
250
+
- return (
251
+
- <>
252
+
- <h2>Car detail page</h2>
253
+
- <p>{params.carId}</p>
254
+
- </>
255
+
- );
256
+
+ return <Car car={mapCarFromApiToVm(car)} />;
215
257
};
216
258
217
-
- const CarPage = (props: Props) => {
218
-
+ const CarPage = async (props: Props) => {
219
-
const { params } = props;
220
-
+ const car = await api.getCar(params.carId);
221
-
+ console.log('Car page', car);
222
-
223
-
- return (
224
-
- <>
225
-
- <h2>Car detail page</h2>
226
-
- <p>{params.carId}</p>
227
-
- </>
228
-
- );
229
-
+ return <Car car={mapCarFromApiToVm(car)} />;
230
-
};
231
-
232
259
export default CarPage;
233
260
234
261
```
@@ -249,15 +276,15 @@ npm run start:prod
249
276
>
250
277
> It will cache on routing navigation.
251
278
252
-
But if we run this code at build time, we need to use [generateStaticParams](https://nextjs.org/docs/app/api-reference/functions/generate-static-params) too:
279
+
But if we want to run this code at build time, we need to use [generateStaticParams](https://nextjs.org/docs/app/api-reference/functions/generate-static-params) too:
0 commit comments