Skip to content

Commit b247003

Browse files
authored
Merge pull request #461 from Lemoncode/feature/update-nextjs
Feature/update nextjs
2 parents 21371ab + ecf198e commit b247003

File tree

16 files changed

+23
-87
lines changed

16 files changed

+23
-87
lines changed

04-frameworks/08-nextjs/01-config/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
"@mui/icons-material": "^5.11.0",
1919
"@mui/material": "^5.11.0",
2020
"axios": "^1.2.1",
21-
"next": "^13.0.7",
21+
"next": "^13.1.1",
2222
"react": "^18.2.0",
2323
"react-dom": "^18.2.0"
2424
},
2525
"devDependencies": {
26-
"@types/node": "^18.11.17",
26+
"@types/node": "^18.11.18",
2727
"@types/react": "^18.0.26",
2828
"@types/react-dom": "^18.0.9",
2929
"cross-env": "^7.0.3",

04-frameworks/08-nextjs/02-navigation/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
"@mui/icons-material": "^5.11.0",
1919
"@mui/material": "^5.11.0",
2020
"axios": "^1.2.1",
21-
"next": "^13.0.7",
21+
"next": "^13.1.1",
2222
"react": "^18.2.0",
2323
"react-dom": "^18.2.0"
2424
},
2525
"devDependencies": {
26-
"@types/node": "^18.11.17",
26+
"@types/node": "^18.11.18",
2727
"@types/react": "^18.0.26",
2828
"@types/react-dom": "^18.0.9",
2929
"cross-env": "^7.0.3",

04-frameworks/08-nextjs/03-boilerplate/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
"@mui/icons-material": "^5.11.0",
1919
"@mui/material": "^5.11.0",
2020
"axios": "^1.2.1",
21-
"next": "^13.0.7",
21+
"next": "^13.1.1",
2222
"react": "^18.2.0",
2323
"react-dom": "^18.2.0",
2424
"sharp": "^0.31.2"
2525
},
2626
"devDependencies": {
27-
"@types/node": "^18.11.17",
27+
"@types/node": "^18.11.18",
2828
"@types/react": "^18.0.26",
2929
"@types/react-dom": "^18.0.9",
3030
"cross-env": "^7.0.3",

04-frameworks/08-nextjs/04-static-site-generation/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
"@mui/icons-material": "^5.11.0",
2020
"@mui/material": "^5.11.0",
2121
"axios": "^1.2.1",
22-
"next": "^13.0.7",
22+
"next": "^13.1.1",
2323
"react": "^18.2.0",
2424
"react-dom": "^18.2.0",
2525
"sharp": "^0.31.2"
2626
},
2727
"devDependencies": {
28-
"@types/node": "^18.11.17",
28+
"@types/node": "^18.11.18",
2929
"@types/react": "^18.0.26",
3030
"@types/react-dom": "^18.0.9",
3131
"cross-env": "^7.0.3",

04-frameworks/08-nextjs/05-server-side-rendering/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
"@mui/icons-material": "^5.11.0",
2020
"@mui/material": "^5.11.0",
2121
"axios": "^1.2.1",
22-
"next": "^13.0.7",
22+
"next": "^13.1.1",
2323
"react": "^18.2.0",
2424
"react-dom": "^18.2.0",
2525
"sharp": "^0.31.2"
2626
},
2727
"devDependencies": {
28-
"@types/node": "^18.11.17",
28+
"@types/node": "^18.11.18",
2929
"@types/react": "^18.0.26",
3030
"@types/react-dom": "^18.0.9",
3131
"cross-env": "^7.0.3",

04-frameworks/08-nextjs/06-client-side-rendering/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If we don't need to pre-render the data and frequently updating data.
1818

1919
- The page is generated on client side.
2020
- Available on pages and internal components.
21-
- You can use [SWR](https://swr.vercel.app/) (stale-while-revalidate) or [React query](https://react-query-v3.tanstack.com/) for handle cache
21+
- You can use [SWR](https://swr.vercel.app/) (stale-while-revalidate) or [React query](https://tanstack.com/query/latest) for handle cache
2222

2323
> SWR is a strategy to first return the data from cache (stale), then send the fetch request (revalidate), and finally come with the up-to-date data
2424

04-frameworks/08-nextjs/06-client-side-rendering/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
"@mui/icons-material": "^5.11.0",
2020
"@mui/material": "^5.11.0",
2121
"axios": "^1.2.1",
22-
"next": "^13.0.7",
22+
"next": "^13.1.1",
2323
"react": "^18.2.0",
2424
"react-dom": "^18.2.0",
2525
"sharp": "^0.31.2"
2626
},
2727
"devDependencies": {
28-
"@types/node": "^18.11.17",
28+
"@types/node": "^18.11.18",
2929
"@types/react": "^18.0.26",
3030
"@types/react-dom": "^18.0.9",
3131
"cross-env": "^7.0.3",

04-frameworks/08-nextjs/07-server-components/README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ npm install
1414

1515
# Server Components
1616

17-
// TODO: Introduccion
18-
1917
Enable `appDir`:
2018

2119
_./next.config.js_
@@ -207,6 +205,8 @@ export default CarListPage;
207205

208206
```
209207

208+
Remove previous page `./src/pages/cars.tsx`.
209+
210210
Why it fails? Because all components inside `app` folder are server components by default but if we need to use client hooks such as `useState`, `useEffect`, `React context`, etc we need to mark it as [Client Component](https://beta.nextjs.org/docs/rendering/server-and-client-components#convention):
211211

212212

@@ -245,8 +245,6 @@ export default CarListPage;
245245

246246
```
247247

248-
Remove previous page `./src/pages/cars.tsx`.
249-
250248
Why it fails? The error is _You have a Server Component that imports next/router. Use next/navigation instead._ Now, if we need a navigation different than `Link` component we have to use router from [next/navigation](https://beta.nextjs.org/docs/routing/linking-and-navigating#userouter-hook) and it will always be a "client" navigation, [next/router will be legacy](https://beta.nextjs.org/docs/upgrade-guide#step-5-migrating-routing-hooks).
251249

252250
_./app/pods/car-list/components/car-item.component.tsx_

04-frameworks/08-nextjs/07-server-components/app/cars/page.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { CarListContainer, api } from '../pods/car-list';
66

77
const CarListPage = async () => {
88
const carList = await api.getCarList({ cache: 'no-store' });
9-
console.log('Car list build time?', { carList });
10-
9+
console.log('Car list build time', { carList });
1110
return <CarListContainer carList={carList} />;
1211
};
1312

04-frameworks/08-nextjs/07-server-components/app/pods/car/car.container.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use client";
1+
'use client'
22

33
import React from 'react';
44
import { useRouter } from 'next/navigation';
@@ -14,7 +14,6 @@ interface Props {
1414
export const CarContainer: React.FunctionComponent<Props> = (props) => {
1515
const router = useRouter();
1616
const car = mapCarFromApiToVm(props.car);
17-
1817
const handleBook = async () => {
1918
try {
2019
const apiCar = mapCarFromVmToApi({ ...car, isBooked: !car.isBooked });

04-frameworks/08-nextjs/07-server-components/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
"@mui/icons-material": "^5.11.0",
2020
"@mui/material": "^5.11.0",
2121
"axios": "^1.2.1",
22-
"next": "13.0.6",
22+
"next": "^13.1.1",
2323
"react": "^18.2.0",
2424
"react-dom": "^18.2.0",
2525
"sharp": "^0.31.2"
2626
},
2727
"devDependencies": {
28-
"@types/node": "^18.11.17",
28+
"@types/node": "^18.11.18",
2929
"@types/react": "^18.0.26",
3030
"@types/react-dom": "^18.0.9",
3131
"cross-env": "^7.0.3",

04-frameworks/08-nextjs/07-server-components/src/layouts/app.layout.module.css

-23
This file was deleted.

04-frameworks/08-nextjs/07-server-components/src/layouts/app.layout.tsx

-36
This file was deleted.

04-frameworks/08-nextjs/07-server-components/src/layouts/index.ts

-1
This file was deleted.

04-frameworks/08-nextjs/99-bonus/01-styles/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
"@mui/icons-material": "^5.11.0",
2020
"@mui/material": "^5.11.0",
2121
"axios": "^1.2.1",
22-
"next": "^13.0.7",
22+
"next": "^13.1.1",
2323
"react": "^18.2.0",
2424
"react-dom": "^18.2.0"
2525
},
2626
"devDependencies": {
27-
"@types/node": "^18.11.17",
27+
"@types/node": "^18.11.18",
2828
"@types/react": "^18.0.26",
2929
"@types/react-dom": "^18.0.9",
3030
"cross-env": "^7.0.3",

04-frameworks/08-nextjs/99-bonus/02-images/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
"@mui/icons-material": "^5.11.0",
2020
"@mui/material": "^5.11.0",
2121
"axios": "^1.2.1",
22-
"next": "^13.0.7",
22+
"next": "^13.1.1",
2323
"react": "^18.2.0",
2424
"react-dom": "^18.2.0"
2525
},
2626
"devDependencies": {
27-
"@types/node": "^18.11.17",
27+
"@types/node": "^18.11.18",
2828
"@types/react": "^18.0.26",
2929
"@types/react-dom": "^18.0.9",
3030
"cross-env": "^7.0.3",

0 commit comments

Comments
 (0)