[Next.js/NextUI] ์—๋Ÿฌ ํ•ด๊ฒฐ : Next UI์˜ Tabs (ํƒญ) ๋ˆŒ๋Ÿฌ ํŽ˜์ด์ง€ ์ด๋™์‹œํ‚ค๊ธฐ + Tab์•ˆ์— Tab (์ด์ค‘ํƒญ) ๋ฌธ์ œํ•ด๊ฒฐ์ค‘
ยท
๐Ÿชด Next.js
4.1 ์ฒ˜์Œ์œผ๋กœ Next UI๋ฅผ ์‚ฌ์šฉํ•ด๋ณด๊ฒŒ ๋˜์—ˆ๋‹ค ์ฐธ๊ณ ๋กœ Next UI๋ฅผ ์ฒ˜์Œ ์…‹ํŒ…ํ•  ๋•Œ๋ถ€ํ„ฐ ์•ฝ๊ฐ„ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋Š”๋ฐ ๊ณต์‹๋ฌธ์„œ์—์„œ ๋นผ๋จน์€ ๋ถ€๋ถ„๋•Œ๋ฌธ์ด์—ˆ๋‹ค ใ… ใ…  Tailwind.config.js ์—์„œ const { nextui } = require("@nextui-org/react"); ์ด ํ•œ ์ค„์„ ๋นผ๋จน์–ด์„œ ์ ์šฉ ์•ˆ๋๋˜ ๊ฒƒ..! ใ…Žใ…Ž ๊ณต์‹๋ฌธ์„œ๋Š” ์—ญ์‹œ ๊ผผ๊ผผํžˆ ๋ด์•ผํ•œ๋‹ค. ์ฒซ ๋ฒˆ์งธ ๋ฌธ์ œ ํ•ด๊ฒฐ 1) ์ƒํ™ฉ (next js - app router ์‚ฌ์šฉ ์ค‘) ๊ทธ๋ฆฌ๊ณ  Next UI ๋ฅผ ํ†ตํ•ด Tabs ๋ฅผ ๋ชจ๋“  ํŽ˜์ด์ง€ ๋ ˆ์ด์•„์›ƒ์—์„œ ํ—ค๋”๋กœ์„œ ์ ์šฉ์‹œ์ผœ๋ณด๋ ค๊ณ  ํ–ˆ๋‹ค https://nextui.org/docs/components/tabs Tabs Tabs organize content into multiple sections and al..
[Next.js] not-found.js (ts(x)) ํŽ˜์ด์ง€ ์ƒ์„ฑ์€ appํด๋” ๋ฐ”๋กœ ๋ฐ‘์— ํ•˜๊ธฐ
ยท
๐Ÿชด Next.js
The not-found file is used to render UI when the notFound function is thrown within a route segment. Along with serving a custom UI, Next.js will return a 200 HTTP status code for streamed responses, and 404 for non-streamed responses. Good to know: In addition to catching expected notFound() errors, the root app/not-found.js file also handles any unmatched URLs for your whole application. This ..
[Next.js] Setting : yarn create next-app (+ yarn dev ์‹คํ–‰ ์—๋Ÿฌ ํ•ด๊ฒฐํ•˜๊ธฐ)
ยท
๐Ÿชด Next.js
0319 next.js ์‹ฌํ™”ํ”„๋กœ์ ํŠธ ํŒ€์žฅ๋‹˜๊ณผ ํ•จ๊ป˜ ํ”„๋กœ์ ํŠธ ์ดˆ๊ธฐ ์…‹ํŒ…์„ ํ•˜๋ฉด์„œ Next.js ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ–ˆ๋‹ค. ๊ฐ•์˜์—์„œ ๋ฐฐ์šด๊ฑด npx create-next-app ๋ช…๋ น์–ด ์˜€์ง€๋งŒ, ์ดํ›„ ํŠœํ„ฐ๋‹˜์€ yarn add ๋“ฑ์œผ๋กœ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์„ค์น˜ํ•˜์…จ๊ณ  ใ… ใ…  ์ด๋Ÿฐ ๊ฒฝ์šฐ package.lock.json ๊ณผ yarn.lock ๋ชจ๋‘ ์ƒ๊ฒจ์„œ ์ถฉ๋Œ์ด ์žˆ์ง€์•Š์„๊นŒ ์šฐ๋ ค๋˜์—ˆ๋‹ด.. (๊ทธ์ „์— ์ถฉ๋Œ์ด ๋‚˜์„œ ์ง€์šด ์ ์ด ์žˆ์—ˆ๊ธฐ ๋•Œ๋ฌธ์—..) ๋ฌผ๋ก  ์ด์ „์—๋„ yarn create ๋กœ ํ•  ๋•Œ yarn ์—์„œ์˜ ๋ฌธ์ œ๊ฐ€ ์žˆ์–ด npx create ๋ฅผ ๊ถŒ๊ณ ํ•˜์…จ์—ˆ์ง€๋งŒ ๋‹ค๋“ค yarn ์„ ๋งŽ์ด ์“ฐ๊ณ  ์žˆ๊ธฐ๋„ ํ•˜๊ณ .. ! ๊ทธ๋ž˜์„œ yarn create next-app ์„ ํ•ด๋ณด๊ธฐ๋กœ ํ–ˆ๋‹ค. ๐Ÿช„ 1. yarn ์œผ๋กœ create next-app ํ•˜๋Š” ๋ฐฉ๋ฒ• ์•Œ์•„๋ณด๊ธฐ 1) ..
[Next.js/TS] Next.js์˜ ๋ Œ๋”๋ง ํŒจํ„ด(SSG,ISR,SSR,CSR)/Route Handler๋ฅผ ์‚ฌ์šฉํ•œ TO Do List
ยท
๐Ÿชด Next.js
24.3.15 ๐Ÿซง ๋ฐฐ์šด Next.js์˜ ๊ฐœ๋…์„ ํ† ๋Œ€๋กœ ๊ฐ„๋‹จํžˆ ๋งŒ๋“  To Do List ํ”„๋กœ์ ํŠธ ๊ธฐ๊ฐ„: 3.12 ~ 3.15 ์ธ๋ฐ, ์‚ฌ์‹ค ๊ตฌํ˜„์ž์ฒด๋Š” ๋นจ๋ฆฌ ๋๋ƒˆ๋˜ ๊ฑฐ ๊ฐ™๋‹ค. (๊ทผ๋ฐ ๊ทธ ๋’ค์— json-server - vercel ๋ฐฐํฌ๋ฅผ ์‹œ๋„ํ•˜๋‹ค๊ฐ€ ์˜ค๋ฅ˜๊ฐ€ ๋‚˜๊ณ ... localhost๋ฅผ 127.0.0.1๋กœ ๋ฐ”๊ฟ”๋ณด๋‹ค๊ฐ€ CORS ์—๋Ÿฌ๋ฅผ ์ ‘ํ•ด์„œ ใ… ใ…  ์ด๋ฅผ ํ•ด๊ฒฐํ•ด๋ณด๊ณ ์žˆ๋Š” ์ค‘์ด๋‹ค.. ) 0) ํ™ˆ ๋ฉ”์ธ ํŽ˜์ด์ง€ 1) About ํŽ˜์ด์ง€ SSG๋กœ, (fetch ์˜ต์…˜ - force-cache, ํ˜น์€ ์„ค์ • ์•ˆํ•ด๋„ ๋จ) ๋งŒ๋“ค์–ด build ์‹œ์˜ ๋ฐ์ดํ„ฐ๋กœ ๊ณ ์ •๋˜์–ด ๋ Œ๋”๋ง. ํšŒ์‚ฌ์ •๋ณด์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์™€์„œ ๋ณด์—ฌ์ค€๋‹ค. (companyInfo - image, name, description) * ์„œ๋ฒ„ ์ปดํฌ๋„ŒํŠธ์ด๊ธฐ ๋•Œ๋ฌธ์—, ๋ฐ”๋กœ json-se..
[Next.js] Route Handler๋ฅผ ํ†ตํ•ด ๋ฐฑ์—”๋“œ ๊ตฌํ˜„ํ•ด๋ณด๊ธฐ
ยท
๐Ÿชด Next.js
3.14
[Next.js] SSG(Static Site Generation) ๋ Œ๋”๋ง ์‹œ DB ๋ณ€๋™์‚ฌํ•ญ ์ ์šฉ์œ„ํ•ด Cache ๋น„์šฐ๊ธฐ
ยท
๐Ÿชด Next.js
Next.js ๊ณผ์ œ๋ฅผ ํ•˜๋ฉฐ SSG ๋ Œ๋”๋ง์œผ๋กœ About ํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ค์–ด์•ผ ํ–ˆ๋‹ค. (ํšŒ์‚ฌ ์†Œ๊ฐœ ํŽ˜์ด์ง€) ๊ทธ๋Ÿฐ๋ฐ ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด npm run dev (yarn dev) ๋กœ ๋กœ์ปฌ ์„œ๋ฒ„๋ฅผ ํ†ตํ•ด ํ™•์ธํ•˜๋‹ค๊ฐ€, DB ๋ฐ์ดํ„ฐ (json-server ์˜ db.json) ๋ฅผ ๋ณ€๊ฒฝํ–ˆ๋Š”๋ฐ (๊ณผ์ œ์—์„  json-server ๋ฅผ ํ™œ์šฉ - ์›๋ž˜ BaaS์ด์ง€๋งŒ ์ด ๊ณผ์ œ์—์„  ์ž„์˜๋กœ DB๋กœ ์‚ผ์•„์„œ ์“ฐ๊ณ ์žˆ๋‹ค) ๋ณ€๊ฒฝ๋œ ๋ฐ์ดํ„ฐ๊ฐ€ ๋ฐ˜์˜๋˜์ง€ ์•Š์•˜๋‹ค .. ๐Ÿ˜ฅ ์ด๋Š” SSG ๋ Œ๋”๋ง ํŠน์„ฑ ์ƒ force-cache ๋กœ ์บ์‹œ๊ฐ€ ์ €์žฅ๋˜์–ด ์œ ์ง€๋˜๊ธฐ ๋•Œ๋ฌธ์ธ๋ฐ, ๊ฐ„๋‹จํžˆ ์บ์‹œ ํŒŒ์ผ ์‚ญ์ œํ•˜๋Š” ๋ฒ•์„ ์•Œ์•„๋ณด์ž. ์ €๋ฒˆ ๊ธ€์—์„œ๋„ ์ •๋ฆฌํ–ˆ์ง€๋งŒ, SSG๋ฅผ ๋‹ค์‹œ ์„ค๋ช…ํ•ด๋ณด์ž๋ฉด ๐Ÿชจ SSG (Static Site Generation) ์›น ๋ Œ๋”๋ง ๋ฐฉ์‹์€ ๋นŒ๋“œ ํƒ€์ž„๋•Œ ๋ฏธ๋ฆฌ ํŽ˜์ด์ง€๋ฅผ ๋ Œ๋”๋ง ..
[Next.js] ๋ Œ๋”๋ง ํŒจํ„ด 4๊ฐ€์ง€
ยท
๐Ÿชด Next.js
0312 !
[Next.js] Next.js ์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๊ธฐ (๊ธฐ๋Šฅ, ํ•œ๊ณ„์  ๋“ฑ)
ยท
๐Ÿชด Next.js
0311 โœ๏ธ ๐Ÿ”ฎ Next.js ์˜ ๊ธฐ๋ณธ ์†Œ๊ฐœ Vercel์—์„œ React.js๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๋งŒ๋“ , ์›น ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ํ”„๋ ˆ์ž„์›Œํฌ Route Handler๋ฅผ ํ†ตํ•ด ๋ฐฑ์—”๋“œ๋ฅผ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ์–ด, ํ’€ ์Šคํƒ ์›น ๊ฐœ๋ฐœ์ด ๊ฐ€๋Šฅ + ์—ฌ๊ธฐ์„œ ํ”„๋ ˆ์ž„์›Œํฌ๋ž€? ๊ฐœ๋ฐœ์ž๊ฐ€ ๊ธฐ๋Šฅ ๊ตฌํ˜„์—๋งŒ ์ง‘์ค‘ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•„์š”ํ•œ ๋ชจ๋“  ํ”„๋กœ๊ทธ๋ž˜๋ฐ์  ์žฌ์›์„ ์ง€์›ํ•˜๋Š” '๊ธฐ์ˆ ์˜ ์กฐํ•ฉ'์œผ๋กœ, ๋ณ„๋„์˜ ์…‹ํŒ…์„ ๊ฐœ๋ฐœ์ž๊ฐ€ ํ•  ํ•„์š” ์—†์ด ํ”„๋ ˆ์ž„์›Œํฌ๊ฐ€ ๋‹ค ์•Œ์•„์„œ ํ•ด์ค˜์„œ ํŽธ๋ฆฌํ•˜๊ฒŒ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๋‹ค! Ex ) Next.js, ํ˜น์€ JS๊ธฐ๋ฐ˜ ์›น FE SPA ํ”„๋ ˆ์ž„์›Œํฌ๋“ค์ธ Vue.js, Augular.js ๋“ฑ) + ์ด์— ๋ฐ˜ํ•ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ๊ณตํ†ต ๊ธฐ๋Šฅ์˜ ๋ชจ๋“ˆํ™”๊ฐ€ ์ด๋ฃจ์–ด์ง„ ํ”„๋กœ๊ทธ๋žจ์˜ ์ง‘ํ•ฉ. ๊ฐœ๋ฐœ์ž์˜ ๋ณ„๋„ ์…‹ํŒ…์ด ํ•„์š”ํ•˜๋ฉฐ, ํ”„๋ ˆ์ž„์›Œํฌ๋ณด๋‹ค ๊ธฐ๋Šฅ์ ์œผ๋กœ ๋ถ€์กฑํ•˜๋‹ค๊ณ  ํ•  ์ˆ˜ ์žˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, Rou..