inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

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

4.4 getBy~, queryBy~ 질문입니다

해결됨

실무에 바로 적용하는 프런트엔드 테스트 - 1부. 테스트 기초: 단위・통합 테스트

마지막, 삭제 버튼 테스트 Q. 삭제 버튼을 누르면 TableRow가 사라지니까 queryByText('text').not.toBeInTheDocument() 를 사용해서 유무를 확인 하셨는데 getByText('text').not.toBeInTheDocument() 를 사용해서 해당 텍스트가 있는 요소가 없으면 에러가 나타나도록 유도해서 테스트 검증할 수도 있지 않나요?? 가능은 한건지, 권장이 되지 않는건지 질문 드립니다

  • javascript
  • react
  • 소프트웨어-테스트
  • vitest
allmy 댓글 1 좋아요 1 조회수 194

숙제 : 같은 값을 넣은경우 에러 처리

미해결

비전공자의 전공자 따라잡기 - 자료구조(with JavaScript)

class Node { constructor(value) { this.value = value; this.left = null; this.right = null; } } class BinarySearchTree { constructor() { this.root = null; } #insert(node, value) { if (node.value > value) { // 루트노드보다 작은 값이면 if (node.left) { this.#insert(node.left, value); } else { node.left = new Node(value); } } else { // 숙제 : 같은 값을 넣은경우 에러 처리 (alert, throw) if (node.value === value) throw new Error(`이미 해당 ${value}가 존재 합니다`); // 루트노드보다 큰 값이면 if (node.right) { this.#insert(node.right, value); } else { node.right = new Node(value); } } } insert(value) { if (!this.root) { this.root = new Node(value); } else { this.#insert(this.root, value); // 숙제 : 같은 값을 넣은경우 에러 처리 (alert, throw) } } search(value) {} remove(value) {} } const bst = new BinarySearchTree(); bst.insert(8); //bst.insert(8); // Error: 이미 해당 8가 존재 합니다 bst.insert(10); //bst.insert(10); // Error: 이미 해당 10가 존재 합니다 bst.insert(3); //bst.insert(3); // Error: 이미 해당 3가 존재 합니다 bst.insert(1); //bst.insert(1); // Error: 이미 해당 1가 존재 합니다 bst.insert(14); //bst.insert(14); // Error: 이미 해당 14가 존재 합니다 bst.insert(6); //bst.insert(6); // Error: 이미 해당 6가 존재 합니다 bst.insert(7); //bst.insert(7); // Error: 이미 해당 7가 존재 합니다 bst.insert(4); //bst.insert(4); // Error: 이미 해당 4가 존재 합니다 bst.insert(13); //bst.insert(13); // Error: 이미 해당 13가 존재 합니다 숙제 코드 정답일까요?

  • javascript
  • 코딩-테스트
  • 알고리즘
rhkdtjd_12 댓글 1 좋아요 0 조회수 210

영상 중간에 0:10 1:23초 수정에 따른 코드 최종본

해결됨

비전공자의 전공자 따라잡기 - 자료구조(with JavaScript)

class Node { constructor(value) { this.value = value; this.left = null; this.right = null; } } class BinarySearchTree { constructor() { this.root = null; } #insert(node, value) { if (node.value > value) { // 루트노드보다 작은 값이면 if (node.left) { this.#insert(node.left, value); } else { node.left = new Node(value); } } else { // 루트노드보다 큰 값이면 if (node.right) { this.#insert(node.right, value); } else { node.right = new Node(value); } } } insert(value) { if (!this.root) { this.root = new Node(value); } else { this.#insert(this.root, value); // 숙제 : 같은 값을 넣은경우 에러 처리 (alert, throw) } } search(value) {} remove(value) {} } const bst = new BinarySearchTree(); bst.insert(8); bst.insert(10); bst.insert(3); bst.insert(1); bst.insert(14); bst.insert(6); bst.insert(7); bst.insert(4); bst.insert(13); 영상 따라 했는데 안되면 해당 코드 참고 해보세용!

  • javascript
  • 코딩-테스트
  • 알고리즘
rhkdtjd_12 댓글 1 좋아요 1 조회수 171

동적으로 html 생성 후 이벤트 위임 질문 있습니다.

미해결

인터랙티브 웹 개발 제대로 시작하기

안녕하세요. 이벤트 위임 연습하다가 변칙적으로 연습하고 있는데요. 동적으로 html 생성 된 후에 버튼에 ''-active"클래스 추가 하면 실제로 클래스가 추가가 안되네요. 그런데 elem을 consol 창에 찍어보면 "-avtive"클래스가 추가된 요소로 나오는데 이건 무슨 문제일까요? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>스크립트 연습</title> <style> *, *::before, *::after {margin:0; padding:0; box-sizing:border-box;} h1 {padding:20px 0;} h2 {padding-bottom:20px;} li {list-style:none;} .container {max-width:1000px; margin:0 auto; padding:0 20px; background-color:#f1f1f1;} .wrap {padding:40px; border:1px solid #888;} .wrap + .wrap {margin-top:50px;} .btn-list {display:flex; justify-content:space-between; gap:20px; width:100%; padding:20px; background-color:dodgerblue;} .btn-list li {width:calc(100% / 3);} .btn-list__item {width:100%; padding:10px;} .btn-list__item.-active {background-color:darkkhaki;} </style> </head> <body> <div class="container"> <h1>스크립트 연습</h1> <section class="wrap btn-wrap"> <h2>버튼 연습</h2> <ul class="btn-list"> <!-- <li class="asdf"><button class="btn-list__item"><span>버튼</span> 1버튼</button></li> <li class="asdf"><button class="btn-list__item"><span>버튼</span> 2버튼</button></li> <li class="asdf"><button class="btn-list__item"><span>버튼</span> 3버튼</button></li> --> </ul> </section> <script> window.addEventListener('DOMContentLoaded', initHandler) function initHandler() { buttonListHandler(); } function buttonListHandler() { const btnWrap = document.querySelector('.btn-wrap'); const btnList = document.querySelector('.btn-list'); let currentItem = null; function clickHandler(el) { let elem = el.target; while (!elem.classList.contains('btn-list__item')){ elem = elem.parentNode; // console.log(elem) if(elem.nodeName === 'BODY'){ elem = null; return; } } if(currentItem){ currentItem.classList.remove('-active'); } if(elem.classList.contains('btn-list__item')){ elem.classList.add('-active'); currentItem = elem; } console.log(elem); } btnWrap.addEventListener('click', ()=> { const htmlStr = ` <li><button class="btn-list__item"><span>버튼</span> 1버튼</button></li> <li><button class="btn-list__item"><span>버튼</span> 2버튼</button></li> <li><button class="btn-list__item"><span>버튼</span> 3버튼</button></li> `; btnList.innerHTML = htmlStr; }) btnWrap.addEventListener('click', clickHandler); } </script> </div> </body> </html>

  • HTML/CSS
  • javascript
  • 인터랙티브-웹
김재환 댓글 1 좋아요 0 조회수 294

인터셉팅 라우터 활용도

미해결

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

안녕하세요. 실무에서 인터셉팅 라우팅 활용 빈도가 잦을까요? 클론코딩이라 x.com 에서 사용한 방식 그대로 만들기 위한 학습인지 아니면 실무에서도 사용빈도가 높은지 궁금합니다 강의는 들어서 인터셉팅 라우팅을 이해하긴 했지만 실무에서는 로그인, 회원가입 팝업 띄울때 인터셉팅 라우팅을 사용하지 않을것같은 생각이 들어서 질문드립니당 감사합니다

  • react
  • next.js
  • react-query
  • next-auth
  • msw
wkdejrtlr 댓글 1 좋아요 0 조회수 236

rotateY()에서 deg에 따른 차이

미해결

인터랙티브 웹 개발 제대로 시작하기

오른쪽 벽에서 transform을 아래와 같이 설정하면 브라우저를 통해 보여지는 길이가 다릅니다. 이유가 뭘까요? transform: rotateY(-90deg) translateZ(400vw);

  • HTML/CSS
  • javascript
  • 인터랙티브-웹
ddd 댓글 1 좋아요 0 조회수 226

Link 컴포넌트의 prefetching 기능

해결됨

Next.js 시작하기

안녕하세요! Link 컴포넌트의 prefetching 기능에 대해 궁금한 점이 있어 질문 남깁니다. 뷰포트에 들어오는 Link 영역에 대해 미리 데이터를 끌어온다고 하셨는데, 어느 정도 범위까지 데이터를 끌어오는걸까요? 만약 그 링크로 연결된 페이지가 서버 사이드 렌더링을 이용하는 페이지라면 페이지를 미리 그려서 HTML 파일을 완성하는 수준까지 prefetching을 하는 걸까요?

  • javascript
  • react
  • next.js
신원세 댓글 1 좋아요 1 조회수 290

백엔드 /api/users/{id}의 응답 데이터에 Followers가 없습니다.

미해결

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

안녕하세요. 강사님 😎 유저 프로필 페이지의 팔로우 버튼을 구현 중에 있었습니다. 예제를 따라하던 중 아래 캡처 이미지와 같이 API /api/users/{id} 의 응답 데이터에 Followers 객체가 없는걸 확인했습니다.. Followers 정보가 없어 세션과 비교하여 팔로잉 여부를 체크할 수가 없네요. 제가 API나 코드를 잘 못 구현하고 있는걸까요?ㅠㅠ (스웨거 및 query-devtool) 강의 영상에는 존재하고요. 추가질문 공부를 집에서는 데스크탑, 카페에서 노트북으로 하다보니 서버를 각각 피씨에 띄우는게 번거로워 하나의 서버를 바라보게 하려고 했습니다. 그래서 개인 서버에 docker형태로 BE서버를 동작시켜 사용하려고 했습니다. 서버는 정상적으로 구동했으나 API 중 인증(로그인)이 필요한 API는 모두 403으로 응답이 오네요ㅠㅠ 방식. 로컬next( localhost:3000 ) -> 외부.BE 서버(be-server:9090) 호출 nest를 알지 못해 깊게 분석은 못해봤고 소스의 logged-in-guard.ts 에 request를 로그로 찍으니 cookie부분이 가 비어 있습니다. import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; import { Observable } from 'rxjs'; @Injectable() export class LoggedInGuard implements CanActivate { canActivate( context: ExecutionContext, ): boolean | Promise<boolean> | Observable<boolean> { const request = context.switchToHttp().getRequest(); console.log(request) return request.user?.id && request.isAuthenticated(); } } 간단하게 해결이 가능하면 조언부탁드리며 아니면 무시해주셔도 됩니다. 🙏

  • react
  • next.js
  • react-query
  • next-auth
  • msw
홍홍 댓글 1 좋아요 0 조회수 225

실수로 style.css를 지워버렸습니다...

미해결

SCSS(SASS)+FLEX 실전 반응형 웹 프로젝트 with Figma

실수로 style.css파일을 지워서 다시 만들려고 style.scss에 watch sass를 눌렀는데 css파일이 다시 생기지가 않아요.. 해결 방법이 없을까요...? ㅠㅠ

  • HTML/CSS
  • javascript
  • sass
  • jquery
  • scss
망고19 댓글 1 좋아요 1 조회수 215

오류로 인해 더 이상 진행이 어려워 문의합니다.

미해결

[코드팩토리] [초급] NestJS REST API 백엔드 완전 정복 마스터 클래스 - NestJS Core

강의 잘 듣고 있습니다. 아래 이미지와 같은 오류가 뜨면서 여러가지(db 삭제, Docker 재 시작, 서버 재 구동, debugger 로 확인..등) 해 봤는데, 원인을 찾을 수가 없어 강사님께 도움 청합니다. 이 전까지 잘 진행되고 있었고, 현재 진행하는 강좌도 반복해 확인 해 봤는데... 위와 같은 이미지 내용만 봐서 찾기 힘드시겠지만, 혹시 하는 심정으로~~ 도움 부탁 드립니다. 꾸~벅.

  • javascript
  • typescript
  • rest-api
  • nestjs
  • backend
SY. Jeoung 댓글 3 좋아요 0 조회수 469

sql 환경 변수 경고 & postgresql 연동

미해결

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트 (장고 4.2 기준)

강의를 보면서 따라하고 있는데, 2가지 문제점이 있습니다. 우선 첫번째는 아래처럼, 환경 변수 관련 경고가 뜬다는 것입니다. 두번째로는 강의에서는 파이참으로 진행하셨는데, 저는 vs 코드로 진행하여서 sqltools를 다운받아, 드라이브 설치후 진행하였는데 mysql은 잘 연동되었는 postgresql은 연동이 안되더라고요. 앞선 환경변수 문제와 관련이 있는것인지 아니라면 어떻게 해결해야하는것인지 궁금합니다. 오류 코드 docker-compose up -d WARN[0000] The "g" variable is not set. Defaulting to a blank string. WARN[0000] The "z" variable is not set. Defaulting to a blank string. WARN[0000] The "gl8f5tn_" variable is not set. Defaulting to a blank string. WARN[0000] The "g" variable is not set. Defaulting to a blank string. WARN[0000] The "z" variable is not set. Defaulting to a blank string. WARN[0000] The "gl8f5tn_" variable is not set. Defaulting to a blank string. WARN[0000] The "g" variable is not set. Defaulting to a blank string. WARN[0000] The "z" variable is not set. Defaulting to a blank string. WARN[0000] The "gl8f5tn_" variable is not set. Defaulting to a blank string. 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.

  • react
  • python
  • django
  • web-api
  • htmx
백종성 댓글 2 좋아요 0 조회수 409

라우팅 관련해서 질문이 있습니다!

미해결

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

안녕하세요 제로초님! 강의 잘 듣고 있습니다. 화면이 mount 되었을 때는 최상단에 존재하는 page.tsx에 의해 localhost:3000 URL가 나오고 있는 상황입니다. 그런데 처음 mount 되었을 때 localhost:3000/login 형태의 URL을 가지려고 한다면 어떤 방법으로 해야할지 궁금합니다! 제가 생각한 방법은 아래와 같은데 좀 더 좋은 방법이 있을까요? 1. 최상단에 존재하는 page.tsx에서 useEffect 내부에 router.push('/login') 을 한다. next 에서 제공하는 redirect 기능을 사용한다.

  • react
  • next.js
  • react-query
  • next-auth
  • msw
bj2525 댓글 1 좋아요 0 조회수 226

동적경로 사용 오류

해결됨

한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지

안녕하세요. Route 부분에 오류가 생겼는데 어떤 부분이 잘못되었는지 모르겠어서 질문 남깁니다. Route 함수에 path 경로를 설정할 때, 동적경로를 설정하고 싶으면 ":"과 함께 파라미터의 값을 적어주는 것으로 압니다. 강사님께서 적은 코드와 제 코드가 다른 점이 없는데, 저는 해당 url에 접근했을 때 url경로에 ':'이 포함되어서 나옵니다. 구글링+gpt를 사용해서 해당 오류를 고치려고 해보았지만 찾을 수 없는 상태입니다. 어떤 부분이 문제일까요? import "./App.css"; import { useReducer, useRef, createContext } from "react"; import { Routes, Route } from "react-router-dom"; import Home from "./Pages/Home"; import New from "./Pages/New"; import Diary from "./Pages/Diary"; import Edit from "./Pages/Edit"; import Notfound from "./Pages/Notfound"; function reducer(state, action) { switch (action.type) { case "CREATE": return [action.data, ...state]; case "UPDATE": return state.map((item) => String(item.id) === String(action.data.id) ? action.data : item ); case "DELETE": return state.filter((item) => String(item.id) !== String(action.data.id)); default: return state; } } const mockData = [ { id: 1, createdData: new Date("2024-06-12").getTime(), emotionId: 1, content: "1번 일기 내용", }, { id: 2, createdData: new Date("2024-06-11").getTime(), emotionId: 2, content: "2번 일기 내용", }, { id: 3, createdData: new Date("2024-05-11").getTime(), emotionId: 3, content: "3번 일기 내용", }, ]; export const DiaryStateContext = createContext(); export const DiaryDispatchContext = createContext(); function App() { const [data, dispatch] = useReducer(reducer, mockData); const idRef = useRef(3); // 새로운 일기 추가 const Create = (createdData, emotionId, content) => { dispatch({ type: "CREATE", data: { id: idRef.current++, createdData, emotionId, content, }, }); }; // 기존 일기 수정 const Update = (id, createdData, emotionId, content) => { dispatch({ type: "UPDATE", data: { id, createdData, emotionId, content, }, }); }; // 기존 일기 삭제 const Delete = (id) => { dispatch({ type: "DELETE", data: { id, }, }); }; return ( <> <DiaryStateContext.Provider value={data}> <DiaryDispatchContext.Provider value={{ Create, Update, Delete }}> <Routes> <Route path="/" element={<Home />} /> <Route path="/new" element={<New />} /> <Route path="/diary/:id" element={<Diary />} /> <Route path="/edit/:id" element={<Edit />} /> <Route path="*" element={<Notfound />} /> </Routes> </DiaryDispatchContext.Provider> </DiaryStateContext.Provider> </> ); } export default App;

  • javascript
  • react
  • node.js
focus0007 댓글 2 좋아요 0 조회수 235

vue3로 따라오시다가 import axios 에러 뜨시는 분들

해결됨

Vue.js 끝장내기 - 실무에 필요한 모든 것

jest.config.js 파일에서 preset 밑에 transformIgnorePatterns: ['node_modules/(?!axios)'], 이거 한 줄 추가해주시면 됩니다.. 이유는 axios 버전이 높아서 jest에서 es6를 인식 못하는것이 문제라고 합니다.. 감사합니다..

  • javascript
  • vue.js
  • vuex
루나 댓글 2 좋아요 2 조회수 494

상품(product) 수정시 const 사용이 안되는 이유

해결됨

코드로 배우는 React 19 with 스프링부트 API서버

안녕하세요 멋진 강의 잘 듣고 있습니다. Todo에서 ReadComponent.js 안에서 read 할때 const makeDiv = () => () 와 같이 Arrow Function을 사용해서 간단하게 표현해주셨는데요, 수정할때도 간단하게 사용해보고 싶어서 Product의 ModifyComponent.js 에서 아래와 같이 만들어 사용해봤습니다. {makeDiv("name", product.pname, "text", handleChangeProduct)} {makeDiv("description", product.pdesc, "text", handleChangeProduct)} {makeDiv("price", product.price, "number", handleChangeProduct)} const makeDiv = (title, value, type, handleChangeProduct) => ( <div className="flex justify-center"> <div className="relative mb-4 flex w-full flex-wrap items-stretch"> <div className="w-1/5 p-6 text-right font-bold">{title}</div> <input className="w-4/5 p-6 rounded-r border border-solid border-neutral-300 shadow-md" name={title} type={type} value={value} onChange={handleChangeProduct} ></input> </div> </div> ); 만들어보니까, price(넘버)는 수정이 되는데, pname과 pdesc는 수정이 안되더라구요, readOnly가 먹혀있었습니다. text와 number가 다른걸까요... 수정이 안되는 이유가 뭔지 궁금합니다ㅠ 추가로, const makeDiv 는 return 아래에 추가를 해주셨는데, return 위에가 아니라 return 아래에 추가한 이유도 궁금합니다. 확인 부탁드립니다. 감사합니다.

  • react
  • spring-boot
  • jpa
  • jwt
  • redux-toolkit
촉촉한 갈매기 댓글 1 좋아요 0 조회수 195

이모션에서 props전달시 화살표함수가 원래 이렇게 생겼나요?

해결됨

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

다른 부분에서 화살표함수 만들면 제대로 만들어지는데 이부분에서만 화살표함수 모양이 다릅니다.

  • react
  • node.js
  • seo
  • graphql
  • next.js
leeyunje96 댓글 2 좋아요 0 조회수 206

인기 태그

인프런 TOP Writers

주간 인기글