inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

172만명의 커뮤니티!! 함께 토론해봐요.

Route Handler 에서 Post 코드 작성해봤는데 계속 에러가 납니다 ㅠㅠ

미해결

Next.js App router 기반 Chat GPT 만들기

제가 수업을 기반으로 작성한 코드는 다음과 같습니다. import { NextResponse } from "next/server"; export async function POST(request: Request, {params}: {params: {testId: string}}){ const userData = await request.json(); console.log("server user data", userData); console.log("server param", params.testId); return NextResponse.json({message: "사용자가 성공적으로 생성되었습니다."}); } "use client"; export default function Page({params} : {params: {id:string}}){ const handlerSubmit = async (e:React.FormEvent) => { const response = await fetch('/api/test/1234', { method: "POST", headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({name: 'test name', email: 'test email'}), }); console.log(e); const data = await response.json(); console.log("response data", data); } return (<>다이나믹 라우트 페이지: {params.id} <button type="submit" onClick={handlerSubmit}> 전송 </button> </>); } 에러 메시지는 다음과 같습니다. ✓ Compiled /dashboard/[id] in 1716ms (597 modules) Error: Route "/dashboard/[id]" used `params.id`. `params` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis at id (c:\study\chatgpt-clone\next-tutorial\app\dashboard\[id]\page.tsx:21:36) 19 | 20 | > 21 | return (<>다이나믹 라우트 페이지: {params.id} | ^ 22 | <button 23 | type="submit" 24 | onClick={handlerSubmit}> GET /dashboard/12345 200 in 2989ms ✓ Compiled /favicon.ico in 406ms (331 modules) GET /favicon.ico 200 in 543ms ✓ Compiled /api/test/[testId] in 337ms (614 modules) server user data { name: 'test name', email: 'test email' } Error: Route "/api/test/[testId]" used `params.testId`. `params` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis at testId (c:\study\chatgpt-clone\next-tutorial\app\api\test\[testId]\route.ts:6:39) 4 | const userData = await request.json(); 5 | console.log("server user data", userData); > 6 | console.log("server param", params.testId); | ^ 7 | 8 | return NextResponse.json({message: "사용자가 성공적으로 생성되었습니다."}); 9 | } server param 1234 POST /api/test/1234 200 in 1402ms 응답은 잘 되는데, 동기? 비동기? 이쪽부분에서 문제가 있는 것 같습니다.. ㅠㅠ 영상이랑 똑같이 따라한 것 같은데.. 뭐가 문제인건지 감이 안잡히네요 ㅠㅠ (혹시 추가로 필요한 코드가 있다면 말씀해주세요 ㅠㅠ )

  • react
  • typescript
  • next.js
  • tailwindcss
  • zustand
  • chatgpt
수하 댓글 2 좋아요 0 조회수 291

블로그로 깃헙 잔디 심기 과정

미해결

3분만에 만드는 깃헙 블로그

레포지토리를 새로 만들고 똑같이 수행한 후에 위니 블로그는 삭제했어요 블로그는 잘 들어가지는데 제목과 카운터만 뜨고 다른 것들은 아예 안 뜹니다..ㅜㅜ 삭제하면 안 되나요?

  • github
  • jupyter-notebook
  • markdown
23326 댓글 1 좋아요 0 조회수 168

프로필 변경 시 사진이 깨져요

미해결

3분만에 만드는 깃헙 블로그

게시글 작성할 때는 이미지 업로드가 잘 되는데 프로필 변경 시 이미지가 깨집니다 ㅜㅜ

  • github
  • jupyter-notebook
  • markdown
23326 댓글 1 좋아요 0 조회수 167

마우스이벤트 형식이 제네릭이아닙니다 오류 해결 못하고 있습니다 어떤 거 인지 알 수 잇을까여?

해결됨

[코드캠프] 부트캠프에서 만든 '완벽한' 프론트엔드 코스

import { ChangeEvent, useState } from "react"; // 리팩토링 const Board = () => { const [writer, setWriter] = useState(""); const [title, setTitle] = useState(""); const [content, setContent] = useState(""); const [isActive, setIsActive] = useState(false); const onChangewriter = (event:ChangeEvent<HTMLInputElement>) => { setWriter(event.target.value); if (event.target.value !== "" && title && content) return setIsActive(true); setIsActive(false); }; const onChangeTitile = (event:ChangeEvent<HTMLInputElement>) => { setTitle(event.target.value); if (writer && event.target.value && content) return setIsActive(true); setIsActive(false); }; const onChangeContent = (event:ChangeEvent<HTMLInputElement>) => { setContent(event.target.value); if (writer && title && event.target.value) return setIsActive(true) setIsActive(false); }; const onClickSubmit = (event:MouseEvent<HTMLButtonElement>) => [ console.log(writer), console.log(title), console.log(content), alert("게시물 등록이 완료되었습니다"), ]; return ( <> 작성자 : <input type="text" onChange={onChangewriter} /> <br /> 제목 : <input type="text" onChange={onChangeTitile} /> <br /> 내용: <input type="text" onChange={onChangeContent} /> <br /> <button onClick={onClickSubmit} style={{ backgroundColor: isActive === true ? "yellow" : "none" }} > 등록 </button> </> ); }; export default Board;

  • react
  • react-native
  • 하이브리드-앱
  • graphql
  • next.js
이 규성 댓글 2 좋아요 0 조회수 140

마우스이벤트 형식이 제네릭이아닙니다 오류 해결 못하고 있습니다 어떤 거 인지 알 수 잇을까여?

해결됨

[코드캠프] 부트캠프에서 만든 '완벽한' 프론트엔드 코스

import { ChangeEvent, useState } from "react"; // 리팩토링 const Board = () => { const [writer, setWriter] = useState(""); const [title, setTitle] = useState(""); const [content, setContent] = useState(""); const [isActive, setIsActive] = useState(false); const onChangewriter = (event:ChangeEvent<HTMLInputElement>) => { setWriter(event.target.value); if (event.target.value !== "" && title && content) return setIsActive(true); setIsActive(false); }; const onChangeTitile = (event:ChangeEvent<HTMLInputElement>) => { setTitle(event.target.value); if (writer && event.target.value && content) return setIsActive(true); setIsActive(false); }; const onChangeContent = (event:ChangeEvent<HTMLInputElement>) => { setContent(event.target.value); if (writer && title && event.target.value) return setIsActive(true) setIsActive(false); }; const onClickSubmit = (event:MouseEvent<HTMLButtonElement>) => [ console.log(writer), console.log(title), console.log(content), alert("게시물 등록이 완료되었습니다"), ]; return ( <> 작성자 : <input type="text" onChange={onChangewriter} /> <br /> 제목 : <input type="text" onChange={onChangeTitile} /> <br /> 내용: <input type="text" onChange={onChangeContent} /> <br /> <button onClick={onClickSubmit} style={{ backgroundColor: isActive === true ? "yellow" : "none" }} > 등록 </button> </> ); }; export default Board;

  • react
  • react-native
  • 하이브리드-앱
  • graphql
  • next.js
이 규성 댓글 1 좋아요 0 조회수 77

새 강의 쿠폰 관련 문의드립니다!

해결됨

[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스

아랫분들처럼 강의를 사두고 이제야 수강하다가 쿠폰 관련한 공지를 늦게 보게 되었는데요. 혹시 아직 쿠폰 발급이 가능할까요?

  • react
  • node.js
  • seo
  • graphql
  • next.js
은파랑 댓글 2 좋아요 0 조회수 313

사이드바에 카테고리 태그 숫자 카운트를 홈에서도 추가하는 방법

미해결

깃헙 블로그(Github blog)로 차별화 된 나만의 홈페이지 만들기!

사이드바가 글에 들어가면 잘 나오지만 홈으로 갔을때도 똑같이 나오게 하고싶은데 어떤식으로 해야 나오게 할 수 있을까요¿¿

  • 블로그
  • github
똥또로로 댓글 1 좋아요 0 조회수 115

next auth 질문

미해결

Next + React Query로 SNS 서비스 만들기

1.next auth core를 설치하는 이유가 있을까요 ? prisma를 사용중인데 beta 버전을 설치하면 prisma adapter와 호환성이 안된다고 하는데 4버전을 사용해도 될까요? 4버전 사용시 export const {auth} 와 같은 코드가 호환될까요? 그리고 middleware 에서 session이 아닌 getToken 으로 토큰을 불러와도 상관 없을까요 ?

  • react
  • next.js
  • react-query
  • next-auth
  • msw
hm_stom 댓글 2 좋아요 0 조회수 219

글이 안 만들어집니다 ㅠㅠ

미해결

깃헙 블로그(Github blog)로 차별화 된 나만의 홈페이지 만들기!

업데이트 내역 실시간으로 확인하면 글이 업데이트가 되는 걸 확인할 수 있는데 왜 실제 홈페이지에서는 업데이트가 안될까요 첫번째 파일 2025-01-03-first.md 이거는 잘 올라가는데 두번째 파일 2025-01-05-first.md 이거부터는 안올라가요 아무리봐도 똑같이했는데 왜그럴까요 ㅠㅠ

  • 블로그
  • github
댓글 1 좋아요 0 조회수 122

ISR 구현에 궁금한 점이 있습니다.

해결됨

한 입 크기로 잘라먹는 Next.js

안녕하세요. 강의 정말 재밌게 보고 있습니다. 딱 두 가지 몇번을 돌려봐도 궁금증이 풀리지 않아 문의드립니다. (* Page Router 를 사용하는 Next 14버전 기준) 1) ISR 질문 ISR은 기본적으로 SSR의 형태라고 생각 되는데(빌드 타임에 페이지를 생성해놓는것이..) 일정 시간을 두고 페이지를 재 생성 한다는 게 이해가 안 갑니다.. 이미 빌드를 마치고 서버에 배포를 했다고 가정하고(제가 원래 백엔드 개발자라..) 그 후에 페이지가 서버에서 재 생성되면 빌드가 다시 한번 이뤄지는건가요..? (빌드가 계속해서 이뤄질수는 없을텐데..) 아니면 처음에는 미리 생성 된 페이지를 전달해주고 이후로는 SSR 형태로 페이지가 생성되는걸까요? 데이터가 계속 최신으로 변경 되니 전체 페이지가 SSG일수는 없을거고(처음 요청에 응답한 페이지만 미리 생성된 페이지일텐데) 초기 SSG에 변경된 데이터만 SSR형식으로 만들어지는 건지.. 상식적으로 리빌드가 계속 될일은 없는데 페이지가 새로 생성이 된다고하니 빌드를 안 했는데 페이지가 생성될수 있나 싶고..제가 너무 틀에 갖혀서.. 2) 동적 페이지 + SSG 방식으로 렌더링하기 이것도 비슷한 결의 질문인 것 같은데요 fallback 옵션을 true로 했을 때 서버에서 필요한 작업을 마치면, 그 이후로는 캐싱이 되어서 없던 요청에 대한 페이지가 반쪽짜리 SSG에서 완전한 SSG로 작동하는건지 궁금합니다. 그리고 만약 캐싱이 되는게 맞다면 서버에서 캐싱이 되는걸까요? 추운 날씨에 감기조심하세요 감사합니다.

  • react
  • typescript
  • next.js
codeflow 댓글 1 좋아요 0 조회수 114

안녕하세요 선생님. django 배포 문의 드립니다.

미해결

포트폴리오 초간단 배포하기

django 백엔드 관련으로 제작해놓고, 배포 정보를 찾다찾다 못찾겠어서 결제했는데, 백엔드 배포는 자바기반이더라구요..... 응용이 어려워서 그런데, django 배포는 어떻게 하면 될까요?

  • linux
  • github
  • nginx
  • django
  • 장고
  • python
  • 백엔드
최다니엘 댓글 2 좋아요 1 조회수 174

강의자료 부탁 드립니다.

미해결

팀 개발을 위한 Git, GitHub 입문

강의자료는 따로 메일로 신청해야 하는건가요? 공유 부탁드립니다. jinhwan.jung@hlcompany.com

  • git
  • github
  • 버전관리시스템
정진환 댓글 1 좋아요 0 조회수 149

next.js 13에 dynamic import 적용 시 SEO 영향

미해결

Next + React Query로 SNS 서비스 만들기

안녕하세요, 아래와 같은 방식으로 dynamic import 적용하려는데 SEO에 부정적인 영향이 가는지 궁금해서 질문드립니다. 조금 찾아보니 Dynamic Import로 모두 제외해 버렸기 때문에 Google Bot 등의 크롤러가 웹 페이지에 방문했을 때 접속한 document 페이지에 크롤링할만한 정보가 없게 될 것이라는 이야기가 있어서 사실인지 궁금합니다. 사실이라면 dynamic import의 해당 단점을 보완할 수 있는 방법으로 ssr:true 설정 이외에 무엇이 있는지 궁금합니다 import dynamic from "next/dynamic"; const Zerocho = dynamic(() => import("features/Zero/components/templates/Zerocho"), { ssr: false }); export default function Hi() { const seo = getPageSeo("hihi"); return ( <> <NextSeo {...seo} /> <SchemaScript schema={schema} /> <Head> <meta name="hello" content={seo.hh} /> </Head> <Title>{seo.title}</Title> <Body> <Zerocho /> </Body> </> ); } export const getServerSideProps = async (context) => { return { props: { mode: true, modeCont: false, ...(await serverSideTranslations(context.gggg, ["hihi", "dodo"])), }, }; };

  • next.js
  • seo
  • dynamicimport
  • 다이나믹임포트
  • 다이내믹임포트
ㅎㅇㄴ 댓글 2 좋아요 0 조회수 178

[js section07-2-2] 타이머 값 변경에 대해서

해결됨

[코드캠프] 부트캠프에서 만든 '완벽한' 프론트엔드 코스

if(타이머 === "아직실행안함") 상태에서 스크롤퍼센트가 >= 0.7 이면 타이머 값을 다른 값으로 변경해주어야 타이머 = setTimeout(()=>{타이머="아직실행안함"},1000) 이 코드로 스로틀링 되는게 아닌가요? 영상에서는 타이머 값을 다른 값으로 변경해주지 않는데 이러면 타이머 = setTimeout(()=>{타이머="아직실행안함"},1000) 이 코드를 추가하기 전과 같지 않나요?

  • react
  • react-native
  • 하이브리드-앱
  • graphql
  • next.js
nabis12 댓글 1 좋아요 0 조회수 95

.eslintrc.json 파일 없음

해결됨

한 입 크기로 잘라먹는 Next.js

안녕하세요. 프로젝트 세팅을 진행하고 파일목록을 보는데, .eslintrc.json 파일은 없고 eslint.config.mjs 파일이 있는 것을 확인했습니다. 이대로 진행을 해도 되는 것일까요..?

  • react
  • typescript
  • next.js
배현아 댓글 2 좋아요 0 조회수 358

새 강의 쿠폰 관련 질문

미해결

[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스

안녕하세요, 비슷한 유형의 질문이 이미 있어 저도 글을 남겨봅니다. 미리 구매해둔 후 이제 듣기 시작하려 하니, 새로운 교육과정으로 리뉴얼 되었다고 하는데, 시기를 놓쳐 쿠폰 혜택을 받지 못했습니다. 해당 강의에 기대를 많이 하고 있었는데, 리뉴얼된 버전으로 듣지 못한다는 사실이 안타까워 혹시 쿠폰을 받을 다른 방법이 없을지 문의드립니다. 감사합니다.

  • react
  • node.js
  • seo
  • graphql
  • next.js
박정은 댓글 2 좋아요 0 조회수 149

hydration 오류 (Fragment key값)

해결됨

Next + React Query로 SNS 서비스 만들기

강사님 안녕하세요, 백엔드 서버 연결하고 게시물(PostForm.tsx) 올리는 부분에서 오류가 발생하여 질문드립니다. (섹션5 - 게시글 업로드 완성) hydration 이슈를 찾아봤는데 ( https://velog.io/@jhplus13/NextJS-React-Hydration-Error-%ED%95%B4%EA%B2%B0%EA%B8%B0 ) typeof window 과 관련있는거 같은데 혼자 해결하기 어려워 링크 첨부드립니다..! 오류해결을 위해 (hydration / PostRecommends.tsx) 해당 부분을 수정하였습니다..! 변수입력확인( Date.now(), Math.random(), new Date() ) + faker 해당부분은 주석처리 했습니다. 태그 중첩 확인, layout.tsx font 연결 확인 [콘솔 에러] intercept-console-error.js:56 A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used: - A server/client branch `if (typeof window !== 'undefined')`. - Variable input such as `Date.now()` or `Math.random()` which changes each time it's called. - Date formatting in a user's locale which doesn't match the server. - External changing data without sending a snapshot of it along with the HTML. - Invalid HTML tag nesting. It can also happen if the client has a browser extension installed which messes with the HTML before React loaded. https://react.dev/link/hydration-mismatch ... <HotReload assetPrefix=""> <ReactDevOverlay state={{nextId:1, ...}} dispatcher={{...}}> <DevRootNotFoundBoundary> <NotFoundBoundary notFound={<NotAllowedRootNotFoundError>}> <NotFoundErrorBoundary pathname="/home" notFound={<NotAllowedRootNotFoundError>} notFoundStyles={undefined} ...> <RedirectBoundary> <RedirectErrorBoundary router={{...}}> <Head> <link> <RootLayout> <html lang="ko" className="__variable..."> <body className="__className_fde3a9" - cz-shortcut-listen="true" > ... ... [Fragment key값 오류내용] // package.json { "name": "zcom", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@auth/core": "^0.27.0", "@fortawesome/fontawesome-svg-core": "^6.7.1", "@fortawesome/free-solid-svg-icons": "^6.7.1", "@fortawesome/react-fontawesome": "^0.2.2", "@tanstack/react-query": "^5.62.11", "@vanilla-extract/css": "^1.16.1", "@vanilla-extract/recipes": "^0.5.5", "@vanilla-extract/sprinkles": "^1.6.3", "classnames": "^2.5.1", "clsx": "^2.1.1", "dayjs": "^1.11.13", "next": "^15.0.4", "next-auth": "^5.0.0-beta.25", "react": "^19.0.0", "react-dom": "^19.0.0", "react-intersection-observer": "^9.14.1", "react-textarea-autosize": "^8.5.6", "zustand": "^5.0.2" }, "devDependencies": { "@faker-js/faker": "^9.3.0", "@tanstack/react-query-devtools": "^5.62.11", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", "@vanilla-extract/next-plugin": "^2.4.7", "@vanilla-extract/webpack-plugin": "^2.3.15", "msw": "^2.6.8", "typescript": "^5" }, "msw": { "workerDirectory": [ "public" ] } }

  • react
  • next.js
  • react-query
  • next-auth
  • msw
인생꿀잼 댓글 3 좋아요 0 조회수 285

input type="hidden"으로 설정 시, 오류 미발생

해결됨

한 입 크기로 잘라먹는 Next.js

7.2) 리뷰 추가 기능 구현하기 > 15:05~ 두 방식 모두 동일하게 입력 필드를 숨김 처리하지만 1번처럼 input의 type을 hidden으로 설정하게 되면 Next.js에서 오류를 발생시키지 않네요. // 1번 방식 <input type="hidden" name="bookId" value={bookId} /> // 2번 방식 <input hidden name="bookId" value={bookId} />

  • react
  • typescript
  • next.js
Next 댓글 2 좋아요 1 조회수 311

싸이월드 만들기 1탄

해결됨

[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스

코드를 아래와 같이 작성하였는데, 이렇게 표시가 됩니다. (사진 참고) 레퍼런스도 참고하여 적었는데 해결이 안 되어서 질문 납깁니다. 또한 fontawesome도 강의 내용대로 연동시키려 하였는데 이모티콘이 보이지 않습니다. 어떻게 해야 할까요? <!DOCTYPE html> <html lang="ko"> <head> <title>홍길동 님의 미니홈피 :: 사이좋은 사람들, 싸이월드</title> <link href="./styles/index.css" rel="stylesheet" /> <script src="https://kit.fontawesome.com/e3aa47cdec.js" crossorigin="anonymous" ></script> </head> <body> <div class="background"> <div class="outerbox"> <div class="wrapper"> <div class="wrapper__left"> <div class="wrapper__left__header"> <!-- TODAY 0 | TOTAL 12345 --> <div class="today"> <span>TODAY</span> <span>0</span> <span> | TOTAL</span> <span>12345</span> </div> </div> <div class="wrapper__left__body"> <div class="left__body__header"> <div class="left__body__header__gray"></div> <div class="left__body__header__line"></div> </div> <div class="left__body__profile"> <div class="profile__detail"> <i class="fa-regular fa-face-grin"></i>이름</div> <div class="profile__detail"> <i class="fa-solid fa-phone"></i>Phone</div> <div class="profile__detail"> <i class="fa-regular fa-envelope"></i>E-mail</div> <div class="profile__detail"> <i class="fa-brands fa-instagram"></i>인스타그램</div> </div> <div class="left__body__footer"> <div class="wrapper__feel"> <div class="feel__title">오늘의 기분</div> <select class="feel__select"> <option>기쁨 😊</option> <option>슬픔 🥲</option> <option>화남 😑</option> <option>분노 🤬</option> </select> </div> </div> </div> <div class="wrapper__right"></div> </div> </div> </div> </body> </html> ------------- css ------------- * { box-sizing: border-box; margin: 0px; } .background { width: 1024px; height: 600px; background-image: url("../images/background.png"); padding: 20px 0px 0px 20px; } .outerbox { width: 808px; height: 544px; background-image: url("../images/outerbox.png"); } .wrapper { display: flex; flex-direction: row; padding: 32px 0 0 32px; } .wrapper__left { width: 208px; height: 472px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; margin-left: 3px; margin-right: 7px; } .wrapper__left__header { width: 100%; height: 30px; display: flex; flex-direction: row; justify-content: center; align-items: center; } .today { padding-top: 10px; font-size: 9px; } .wrapper__left__body { display: flex; flex-direction: column; align-items: center; width: 100%; height: 100%; padding: 20px 30px 0px 30px; border: 1px solid gray; border-radius: 15px; background-color: white; } .left__body__header { width: 100%; display: flex; flex-direction: column; } .left__body__header__gray { width: 148px; height: 133px; background-color: gray; } .left__body__header__line { border-top: 1px dotted black; margin: 12px 0px; } .left__body__profile { font-style: normal; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-start; } .profile__detail { color: #999999; font-size: 10px; margin-bottom: 10px; display: flex; flex-direction: row; } .fas { color: black; margin-right: 10px; width: 5px; height: 5px; } .left__body__footer { width: 100%; margin-bottom: 30px; } .wrapper__feel { display: flex; flex-direction: column; justify-content: center; width: 100%; } .feel__title { font-size: 11px; margin-bottom: 5px; color: gray; } .wrapper__right { width: 524px; height: 472px; background-color: violet; display: flex; flex-direction: column; justify-content: flex-end; padding-left: 5px; }

  • react
  • node.js
  • seo
  • graphql
  • next.js
이세은 댓글 2 좋아요 0 조회수 222

새로운 강의 쿠폰 질문

해결됨

[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스

개인적인 사정으로 오늘에서야 공지사항을 확인했습니다. 기존의 프론트엔드 고농축 코스를 수강중인데 혹시 쿠폰을 다시 발급 받을 수 있을까요? 답변 부탁드립니다. 좋은 강의 제공해주셔서 감사합니다. (+쿠폰함을 확인해보았지만 제공받은 쿠폰이 없었습니다. )

  • react
  • node.js
  • seo
  • graphql
  • next.js
Jinsol Kim 댓글 2 좋아요 0 조회수 200

인기 태그

인프런 TOP Writers

주간 인기글