묻고 답해요
156만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
graphql-codegen 설치 에러
강의를 보고 graphql-codegen 설치를 진행하는데 yarn generate 명령어를 입력하니 아래와 같은 에러가 발생합니다. 수업 자료를 보고 다시 설치해봐도 동일한 오류가 계속 발생합니다.
-
해결됨풀스택 리액트 라이브코딩 - 간단한 쇼핑몰 만들기
오늘 구매햇구요 토씨 하나 안틀리고 클라이언트 환경세팅 9:02까지왔습니다 에러로 안됩니다/
[plugin:vite:react-babel] D:\react_01\shopping-mall\src\routes.tsx: Unterminated string constant. (14:14) 17 | }D:/react_01/shopping-mall/src/routes.tsx:14:1412 | element: <GlobalLayout />, 13 | children: [ 14 | { path: 'D:\', element: <DynamicIndex />, index: true}, | ^ 15 | { path: 'D:\products\:id', element: <DynamicId />, }, 16 | ] at instantiate (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:67:32) at constructor (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:364:12) at TypeScriptParserMixin.raise (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:3365:19) at Object.unterminated (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:2333:20) at readStringContents (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:2065:16) at TypeScriptParserMixin.readString (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:3244:9) at TypeScriptParserMixin.getTokenFromCode (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:2964:14) at TypeScriptParserMixin.getTokenFromCode (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:7267:18) at TypeScriptParserMixin.getTokenFromCode (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:9752:18) at TypeScriptParserMixin.nextToken (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:2451:10) at TypeScriptParserMixin.next (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:2366:10) at TypeScriptParserMixin.eat (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:2371:12) at TypeScriptParserMixin.parseObjectProperty (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:12126:14) at TypeScriptParserMixin.parseObjPropValue (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:12154:100) at TypeScriptParserMixin.parseObjPropValue (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:9482:18) at TypeScriptParserMixin.parsePropertyDefinition (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:12083:17) at TypeScriptParserMixin.parseObjectLike (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11993:21) at TypeScriptParserMixin.parseExprAtom (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11464:23) at TypeScriptParserMixin.parseExprAtom (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:7239:20) at TypeScriptParserMixin.parseExprSubscripts (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11171:23) at TypeScriptParserMixin.parseUpdate (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11153:21) at TypeScriptParserMixin.parseMaybeUnary (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11127:23) at TypeScriptParserMixin.parseMaybeUnary (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:9590:20) at TypeScriptParserMixin.parseMaybeUnaryOrPrivate (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10956:61) at TypeScriptParserMixin.parseExprOps (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10962:23) at TypeScriptParserMixin.parseMaybeConditional (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10937:23) at TypeScriptParserMixin.parseMaybeAssign (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10895:21) at TypeScriptParserMixin.parseMaybeAssign (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:9529:20) at D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10863:39 at TypeScriptParserMixin.allowInAnd (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:12640:12) at TypeScriptParserMixin.parseMaybeAssignAllowIn (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10863:17) at TypeScriptParserMixin.parseExprListItem (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:12380:18) at TypeScriptParserMixin.parseExprList (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:12352:22) at TypeScriptParserMixin.parseArrayLike (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:12240:26) at TypeScriptParserMixin.parseArrayLike (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:8976:24) at TypeScriptParserMixin.parseExprAtom (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11455:23) at TypeScriptParserMixin.parseExprAtom (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:7239:20) at TypeScriptParserMixin.parseExprSubscripts (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11171:23) at TypeScriptParserMixin.parseUpdate (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11153:21) at TypeScriptParserMixin.parseMaybeUnary (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:11127:23) at TypeScriptParserMixin.parseMaybeUnary (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:9590:20) at TypeScriptParserMixin.parseMaybeUnaryOrPrivate (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10956:61) at TypeScriptParserMixin.parseExprOps (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10962:23) at TypeScriptParserMixin.parseMaybeConditional (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10937:23) at TypeScriptParserMixin.parseMaybeAssign (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10895:21) at TypeScriptParserMixin.parseMaybeAssign (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:9529:20) at D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10863:39 at TypeScriptParserMixin.allowInAnd (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:12640:12) at TypeScriptParserMixin.parseMaybeAssignAllowIn (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.js:10863:17) at TypeScriptParserMixin.parseObjectProperty (D:\react_01\shopping-mall\node_modules\@babel\parser\lib\index.j 라고 코드 에러낫구요 이런 상황입니다1화 앱입니다까지 햇고 그뒤로product 페이지 만드는데서안되네요 오늘 구매햇구요 토씨 하나 안틀리고 클라이언트 환경세팅 9:02까지왔습니다 에러로 안됩니다/반품해도될까요? window 환경입니다 지금강의하신것은 mac 으로하시는것으로보입니다만제환경에서는 안될것같군요 원활한 해결책을 보고 환불을 결정하겟습니다
-
해결됨풀스택 리액트 라이브코딩 - 간단한 쇼핑몰 만들기
react-query 에러
3강 학습 중 react-query 버전 문제로 인한 에러가 생겨 질문합니다.최신 버전으로 설치해서 react-query의 가이드 문서대로 코드를 수정했는데도 계속 에러가 나며 data를 가져오지 못 하고 있습니다.어떻게 해결해야 할지 모르겠습니다ㅜ첨부된 사진 외에는 강의대로 코드를 작성했으며 타입스크립트가 아닌 자바스크립트로 진행하고 있습니다.
-
해결됨풀스택 리액트 라이브코딩 - 간단한 쇼핑몰 만들기
uuid 에러
안녕하세요.수업을 듣던중에 같은 방법으로 uuid 라이브러리를 다운받고 실행을 하고있는데 이런 에러가 발생을 하고 있는데혹시 어떤 부분이 문제인지 알수있을까요..?@types/uuid 로 삭제 설치 다시 해보고 진행해도 계속 같은 에러가 발생합니다 ㅠ<package.json> "dependencies": { "@types/uuid": "^8.3.4", "graphql-request": "^5.0.0", "graphql-tag": "^2.12.6", "react": "^18.2.0", "react-dom": "^18.2.0", "react-query": "^3.39.2", "react-router-dom": "^6.4.3", "sass": "^1.56.1" },<handlers.ts>import { v4 as uuid } from "uuid"; const mock_products = Array.from({ length: 20 }).map((_, i) => ({ id: uuid(), imageUrl: `https://placeimg.com/200/150/${i + 1}`, price: 50000, title: `임시상품${i + 1}`, description: `임시상세내용${i + 1}`, createAt: new Date(1668159460287 + i * 1000 * 60 * 60 * 10).toString(), }));<에러 내용>[plugin:vite:import-analysis] Failed to resolve import "uuid" from "src\mocks\handlers.ts". Does the file exist? C:/Users/home/Desktop/배포/shop/shopping/src/mocks/handlers.ts:3:27 1 | import { graphql } from "msw"; 2 | import GET_PRODUCTS from "../graphql/products"; 3 | import { v4 as uuid } from "uuid"; | ^ 4 | const mock_products = Array.from({ length: 20 }).map((_, i) => ({ 5 | id: uuid(), at formatError (file:///C:/Users/home/Desktop/%EB%B0%B0%ED%8F%AC/shop/shopping/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:39971:46) at TransformContext.error (file:///C:/Users/home/Desktop/%EB%B0%B0%ED%8F%AC/shop/shopping/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:39967:19) at normalizeUrl (file:///C:/Users/home/Desktop/%EB%B0%B0%ED%8F%AC/shop/shopping/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:36835:33) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async TransformContext.transform (file:///C:/Users/home/Desktop/%EB%B0%B0%ED%8F%AC/shop/shopping/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:36968:47) at async Object.transform (file:///C:/Users/home/Desktop/%EB%B0%B0%ED%8F%AC/shop/shopping/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:40224:30) at async loadAndTransform (file:///C:/Users/home/Desktop/%EB%B0%B0%ED%8F%AC/shop/shopping/node_modules/vite/dis
-
해결됨풀스택 리액트 라이브코딩 - 간단한 쇼핑몰 만들기
index.tsx에서 ProductItem부분에서 해당 반환 형식이 유효하지 않다고 할 때
index.tsx에서 ProductItem부분에서 해당 반환 형식이 유효하지 않다고 하면서 화면에 Display되지 않을때 어디를 확인하면 되는지 조언 부탁드립니다~데이터는 BASE_URL로 부터 잘 오고 있습니다mac에서 vsc사용하고 있습니다아래는 해당부분입니다import { useQuery } from "react-query" import ProductItem from "../../components/product/item" import { fetcher, QueryKeys } from "../../queryClient" import {Product} from "../../types" const ProductList = () => { const {data} = useQuery<Product[]>(QueryKeys.PRODUCTS, () => fetcher({ method: 'GET', path: '/products' }), ) /* id: 1 title: "Fjallraven - Foldsack No. 1 Backpack, Fits 15 Laptops" price: 109.95 description: "Your perfect pack for everyday use and walks in the forest. Stash your laptop (up to 15 inches) in the padded sleeve, your everyday" category: "men's clothing" image: "https://fakestoreapi.com/img/81fPKd-2AYL._AC_SL1500_.jpg" ▶ rating 2 items rate: 3.9 count: 120 */ return ( <div> <ul> {data?.map(product => ( <ProductItem {...product} key={product.id} /> ))} </ul> </div> ) //return (<div>상품목록</div>) } export default ProductListcomponents/product/item.tsx 파일입니다
-
해결됨GraphQL 완전정복 (키오스크를 만들며 배우는 풀스택 과정) - [2024 부분 리뉴얼]
comments null 출력
안녕하세요! 다른 쿼리문은 잘 출력되는데 comments만 계속 null이 뜹니다.query { comments { text userId }} 위 쿼리문에서{ "data": { "comments": null }}널값이 출력됩니다. 다른 쿼리문은 수업 내용과 같이 출력되고, mutation까지 잘 진행됐는데 코멘트만 null이 떠서 질문 남깁니다. 제가 무슨 실수를 한걸까요?ㅠㅠ
-
해결됨GraphQL 완전정복 (키오스크를 만들며 배우는 풀스택 과정) - [2024 부분 리뉴얼]
m1 meteor 설치 오류!
안녕하세요!meteor 설치 오류로 한참 고통받다 해결한 m1 유저입니다.meteor가 m1에서 호환된다고 공식발표되었지만,여전히 rosetta를 이용한 우회로 설치 가능한 것 같습니다.설치 오류 있으신 분들은 rosetta로 설치해보세요!혹시 저처럼 고통받는 분들이 있으실까봐 공유합니다🥲
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
rendered HTML error 관련
MsgItem 을 이용하여 MsgList 50개를 뽑는 과정에서Error: Text content does not match server-rendered HTML. Error: Hydration failed because the initial UI does not match what was rendered on the server. Error: There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.오류를 만났습니다. 혼자서 분석해본결과 jay와 roy를 랜덤으로 얻기위한 const getRandomUserId = () => UserIds[Math.round(Math.random())]; 이라는 함수를 이용하면 이런에러가 나는것으로 확인되었습니다 선생님 .fill(0).map() 함수에서 getRandomUserId() 를이용하지않고 직접 이름을 "roy" 로 작성하니 오류가 나오지않습니다.. 구글링을해봐도 이유를 알기 어려워서 질문을남깁니다 왜 이런오류가 나오는걸까요.?
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
닉네임 부분이 잘못되어 있는 것 같습니다.
해당 강의 이후에 수정하시는지 모르겠지만 닉네임이 제대로 적용되어있지 않는 것 같습니다.// MsgList.js <MsgItem ... user={...} />현재 해당 강의 시점에서 user을 넘기고 user.nickname으로 표시를 하게 되어 있는데 { id: 'roy', nickname: '로이' } 가 계속 넘어가서 닉네임이 '로이'로만 렌더링되고 있습니다.// MsgList.js <MsgItem ... users={users} /> // MsgItem {users.find(user => user.id === userId).nickname}저는 일단 이런식으로 수정하였는데 닉네임 부분 한번 확인 부탁드립니다! 혼동이 올 수도 있을 것 같습니다 ㅎㅎ..
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
Typescript 질문드려요!
안녕하세요 재남님!Typescript 적용 중에 계속 안되는 부분이 있어서 질문드려요!setQueryData에 2번째 인자인 old에 대해서 타입 지정 중인데 안되는 이유가 궁금합니다!
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
error 관련하여
text contents does not match server-sided HTML이라는 오류가 뜨는게 혹시 어떻게 해결할 수 있을까요? 검색해도 마땅히 제대로 된 답이 안나오네요. 그리고 왜 여기서는 그런 오류가 안생기는지 궁금합니다!
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
질문이 있습니다!.
onCreate 함수에서 질문이 있습니다! 새로운 객체인 createMessages와 기존에 존재하던 15개의 길이를 가진 old.messages를 나열하기만 하면 된다고 생각했는데, 뒤에 ...old.pages.slice(1)을 또 나열을 하는 부분이 이해가 안됩니다!. console.log를 찍어보니 ...old.pages.slice(1)는 빈 배열이 나오는데 어떤 이유때문에 넣어주는지 궁금합니다!
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
질문이 있습니다!
안녕하세요 강사님! 아래와 같이 문제가 있어 질문 남깁니다! graphQL 적용 후 새로고침 시 화면 렌더링 속도가 되게 느려짐 => 어떤 문제인지 잘 모르겠습니다.. Create 후에 getData를 하지 못함(등록 버튼 누르고 새로 fetch를 해야 Create 했던 내용이 나옴)=> 기존에 MsgList 컴포넌트에서 GET_MESSAGES로 fetch 하였을 땐 잘 동작했지만 getServerSideProps함수 안에서 fetch 했더니 동작하지 않는 것 같습니다(추측) React Component Tool에 Hydrate 부분이 Anonymous라고 뜸 => React-query 버전이 올라가면서 문법상에 오류가 있는 건지, Hydrate(캐싱)이 적용 되지 않는 것 같습니다. ㅜㅜ 도와주세요!!!.. _app. js index MsgList(Create Code)
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
수정된 내용까지 확인했는데 에러가 납니다 ㅠ
window에서 대소문자 문제 수정해도 에러가 나네요 ㅠ
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
useRef를 선호하시는 이유가 궁금합니다!
지금까지 input 관리를 컴포넌트로 빼서 useCallback과 useState, onChange 메서드를 사용하여 써왔는데 useRef로 관리할 수 있다는 걸 보고 깜짝 놀랐습니다. 개인적인 선호라고 하셨지만 특별히 이유가 있을까 하여 useRef에 대해 찾아보니 useRef는 input value의 상태가 바뀌어도 리렌더링이 안 되는 이점이 있더라구요. 그렇다면 input이 많은 회원가입 같은 form을 만들 때 useRef를 사용한다면 굳이 useCallback이나 useMemo를 쓰거나 여러 개의 useState 를 만들지 않아도 될 것 같다는 생각에 이르더라구요 이러한 이점 때문에 useRef를 쓰시는 것인지 궁금합니다
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
react-query 4.0.0 버전에선 에러가 납니다
1:00 에서 return null 을 한 뒤 돌려보니 위와 같은 에러가 떠서 확인해보니, react-query: 4.0.0 과는 호환이 안 되는 것을 확인했습니다. 강사님 깃허브에서 버전 확인 후 react-query를 "^3.17.2" 으로 낮춘 뒤 돌려보니 잘 뜹니다... 4.0.0 을 사용하려면 `yarn add @tanstack/react-query`를 따로 설치 후, ` import { QueryClient, QueryClientProvider } from "@tanstack/react-query";` 이렇게 바꿔사용하라는데 이렇게 하면 맞을까요?
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
gql 백틱 안에 색깔 입혀지는 확장프로그램이 어떤건지 알 수 있을까요?
안녕하세요, 사소한 질문인데요, 백틱을 열면 오타 찾기도 힘들고 가독성이 떨어져서 강사님처럼 백틱 뒤에 색깔을 따로 입히고 싶은데 확장프로그램이 뭔지 알 수 있을까요?
-
미해결풀스택 리액트 라이브코딩 - 간단한 쇼핑몰 만들기
2일차 장바구니 작동안하시는분 참고하세요!
꼭 이것이 문제는 아닐수 있습니다 (저는 이렇게 해결됐습니다..!) 2일차를 마추고나니 GET_CART가 새로고침 후 최초 1회만 작동하는 문제가 생기더라고요 1. src/graphql/cart.ts 이 부분 코드가 같은지 확인해주세요 영상에서 편집된것 같습니다(제가 집중안할걸수도..?) 이거를 수정해도 최초 1회만 GET_CART가 작동하는 것은 동일하더라고요 강사님 github(https://github.com/roy-jung/livecode-study_mall) 3일차 commit 코드를 보니 2. src/pages/cart/index.tsx useQuery에서 staleTime, cacheTime을 추가하니 정상작동 하는군요! 제가 앞에서 놓쳤던 부분들이 있어 이러한 문제가 생겼을 수도 있습니다. 혹시 2일차 장바구니에서 오류가 난다면 그저 참고만 해주세요! 제가 삽질을 많이해서 글을 남깁니다,.ㅎㅎ
-
해결됨풀스택 리액트 라이브코딩 - 간단한 쇼핑몰 만들기
2일차 강의중 에러 문의 QueryClient
1일차까지는 강의를 잘따라가고 있었는데요. 2일차 들어서 에러가 발생합니다. yarn run dev를 실행하면 아래와 같은 메시지가 나옵니다. > Local: http://localhost:3000/ > Network: use `--host` to expose ready in 725ms. X [ERROR] Expected ";" but found "client" src/queryClient.ts:20:15: 20 │ retrun client │ ~~~~~~ ╵ ; Build failed with 1 error: src/queryClient.ts:20:15: ERROR: Expected ";" but found "client" 참고로 아래는 강의 따라가고 있는 깃허브 주소입니다. https://github.com/ucoder-git/vowing-live/blob/main/shopping-mall/src/queryClient.ts import { QueryClient } from 'react-query' type AnyOBJ = { [key: string]: any } export const getClient = (() => { let client: QueryClient | null = null return () => { if (!client) client = new QueryClient({ defaultOptions: { queries: { cacheTime: 1000 * 60 * 60 * 24, staleTime: 1000 * 60, refetchOnMount: false, refetchOnReconnect: false, refetchOnWindowFocus: false, }, }, }) retrun client } })() const BASE_URL = "https://fakestoreapi.com"
-
해결됨풀스택 리액트 토이프로젝트 - REST, GraphQL (for FE개발자)
typeScript에 대한 질문을 어디다가 올려야할지 몰라서 여기다가 남깁니다!
const fetcher = async ( method: METHOD, url: string, ...rest: { [key: string]: any }[] ) => { const res = await axios[method](url, ...rest) return res.data } export default fetcher 위에 ...rest 에 대한 타입이 궁금해서 질문드립니다! 글을 새로 생성하거나 수정했을때 아래와 같이 객체로 정보가 담기게 되는데요! 1. key값은 id, text, timestamp, userId 라고 생각하면 되는건가요? 2. any는 response에 대한 타입인건가요? 3. Array 안에 Object로 감싸져 있어서 { [key: string]: any} []로 타입을 지정해준건가요? 위에 3가지 질문이 궁금합니다.. ㅜ { id: "36e1a2bc-177b-4743-9152-d7423c7b9e18" text: "asd" timestamp: 1654591409339 userId: "jin" }