묻고 답해요
161만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
D-Day강의 중에 오류가 있네요. 수정 좀 해줘요
훈훈한 자바스크립트 강의 중에 D-Day 사이트 만들기 강의가 있는데, 설명 복잡한 건 그렇다 쳐도, 최종적으로 코드에 오류가 있더라고요. 새로 고침을 하게 되면 사이트 로컬 스토리지 에서, 데이터가 사라져 있는 걸 볼 수가 있어요. 해결 방법 알려주세요.
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
React 실전프로젝트 질문
왜 강의와 다르게 이렇게 표시되는게 맞는지 굼금해서 올려봅니다.아니라면 왜 이런지 알려주시면 감사하겠습니다.밑에는 App.css입니다.@import url('https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&family=Yeon+Sung&display=swap'); body { background-color: #f6f6f6; display: flex; justify-content: center; align-items: center; font-family: 'Nanum Pen Script'; min-height: 100vh; margin: 0px; } @media (min-width: 650px) { .App { width: 640px; } } @media (max-width: 650px) { .APP { width: 90vw; } } #root { background-color: white; box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; } .App { min-width: 100vh; padding-left: 20px; padding-left: 20px; } /* my button */ .MyButton { cursor: pointer; border: none; border-radius: 5px; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 20px; font-size: 18px; white-space: nowrap; font-family: 'Nanum Pen Script'; } .MyButton_default { background-color: #ececec; color: black; } .MyButton_positive { background-color: #64c964; color: white; } .MyButton_negative { background-color: #fd565f; color: white; } /* header */ header { padding-top: 20px; padding-bottom: 20px; display: flex; align-items: center; border-bottom: 1px solid #e2e2e2; } header > div { display: flex; } header .head_text { width: 50%; font-size: 25px; justify-content: center; } header .head_btn_left { width: 25%; justify-content: start; } header .head_btn_right { width: 25%; border-left: 25px; justify-content: end; } header button { font-family: 'Nanum Pen Script'; } /* DiaryList */ .DiaryList .menu_wrapper { margin-top: 20px; margin-bottom: 30px; display: flex; justify-content: space-between; } .DiaryList .menu_wrapper .right_col { flex-grow: 1; } .DiaryList .menu_wrapper .right_col button { width: 100%; } .DiaryList .ControlMenu { margin-right: 10px; border: none; border-radius: 5px; background-color: #ececec; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 20px; cursor: pointer; font-family: 'Nanum Pen Script'; font-size: 18px; } /* DiaryItem */ .DiaryItem { padding-top: 15px; padding-bottom: 15px; border-bottom: 1px solid #e2e2e2; display: flex; justify-content: space-between; } .DiaryItem .emotion_img_wrapper { cursor: pointer; min-width: 120px; height: 80px; border-radius: 5px; display: flex; justify-content: center; } .DiaryItem .emotion_img_wrapper_1 { background-color: #64c964; } .DiaryItem .emotion_img_wrapper_2 { background-color: #9dd772; } .DiaryItem .emotion_img_wrapper_3 { background-color: #fdce17; } .DiaryItem .emotion_img_wrapper_4 { background-color: #fd8446; } .DiaryItem .emotion_img_wrapper_5 { background-color: #fd565f; } .DiaryItem .emotion_img_wrapper img { width: 50%; } .DiaryItem .info_wrapper { flex-grow: 1; margin-left: 20px; cursor: pointer; } .DiaryItem .diary_date { font-weight: bold; font-size: 25px; margin-bottom: 5px; } .DiaryItem .diary_centent_preview { font-size: 18px; } .DiaryItem .btn_wrapper { min-width: 70px; } /* DirayEditor */ .DirayEditor textarea { font-family: 'Nanum Pen Script'; font-size: 20px; box-sizing: border-box; width: 100%; min-height: 200px; resize: vertical; border: none; border-radius: 5px; background-color: #ececec; padding: 20px; } .DirayEditor .control_box { display: flex; justify-content: space-between; align-items: center; } .DirayEditor section { margin-bottom: 40px; } .DirayEditor h4 { font-size: 22px; font-weight: bold; } .DirayEditor .input_date { border: none; border-radius: 5px; background-color: #ececec; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 20px; cursor: pointer; font-family: 'Nanum Pen Script'; font-size: 20px; } .DirayEditor .emotion_list_wrapper { display: grid; grid-template-columns: repeat(5, auto); gap: 2%; } /* EmotionItem */ .EmotionItem { cursor: pointer; border-radius: 5px; padding-top: 20px; padding-bottom: 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; } .EmotionItem img { width: 50%; margin-bottom: 10px; } .EmotionItem span { font-size: 18px; } .EmotionItem_off { background-color: #ececec; } .EmotionItem_on_1 { background-color: #64c964; color: white; } .EmotionItem_on_2 { background-color: #9dd772; color: white; } .EmotionItem_on_3 { background-color: #fdce17; color: white; } .EmotionItem_on_4 { background-color: #fd8446; color: white; } .EmotionItem_on_5 { background-color: #fd565f; color: white; }
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
UPDATE_BOARD 400error
useForm 이용해서 하고있는데 update_board를 할때 계속 try에서 catch(error)로 넘어가네요 ㅠpresenter.jsimport * as S from "./BoardWriter.styles"; export default function BoardWriteUI(props) { return ( <S.Wrapper onSubmit={props.isEdit? props.handleSubmit(props.onClickUpdate, props.onInValid) : props.handleSubmit(props.onValid, props.onInValid)}> <S.Title>{props.isEdit? "게시글 수정": "게시글 등록"}</S.Title> <S.WriterWrapper> <S.InputWrapper> <S.Label>작성자</S.Label> <S.Writer {...props.register("writer", { validate : (value) => value ? true:"작성자를 작성해주세요."} )} onChange={e => props.onChangeWriter(e)} type="text" placeholder="이름을 적어주세요."/> <S.Error>{props.errors.writer?.message}</S.Error> </S.InputWrapper> <S.InputWrapper> <S.Label>비밀번호</S.Label> <S.Password {...props.register("password", { validate : (value) => value? true: "비밀번호를 작성해주세요."} )} onChange={e => props.onChangePassword(e)} type="password" placeholder="비밀번호를 작성해주세요." /> <S.Error>{props.errors.password?.message}</S.Error> </S.InputWrapper> </S.WriterWrapper> <S.InputWrapper> <S.Label>제목</S.Label> <S.Subject {...props.register("title", { validate : (value) => value? true: "제목을 작성해주세요."} )} onChange = {e => props.onChangeTitle(e)} type="text" placeholder="제목을 작성해주세요." /> <S.Error>{props.errors.title?.message}</S.Error> </S.InputWrapper> <S.InputWrapper> <S.Label>내용</S.Label> <S.Contents {...props.register("contents", { validate : (value) => value? true: "내용을 작성해주세요."} )} onChange={e => props.onChangeContents(e)} placeholder="내용을 작성해주세요." /> <S.Error>{props.errors.contents?.message}</S.Error> </S.InputWrapper> <S.InputWrapper> <S.Label>주소</S.Label> <S.ZipcodeWrapper> <S.Zipcode {...props.register("boardAddress")} placeholder="07250" /> <S.SearchButton>우편번호 검색</S.SearchButton> </S.ZipcodeWrapper> <S.Address /> <S.Address /> </S.InputWrapper> <S.InputWrapper> <S.Label>유튜브</S.Label> <S.Youtube {...props.register("youtubeUrl")} placeholder="링크를 복사해주세요." /> </S.InputWrapper> <S.ImageWrapper> <S.Label>사진첨부</S.Label> <S.UploadButton>+</S.UploadButton> <S.UploadButton>+</S.UploadButton> <S.UploadButton>+</S.UploadButton> </S.ImageWrapper> <S.OptionWrapper> <S.Label>메인설정</S.Label> <S.RadioButton type="radio" id="youtube" name="radio-button" /> <S.RadioLabel htmlFor="youtube">유튜브</S.RadioLabel> <S.RadioButton type="radio" id="image" name="radio-button" /> <S.RadioLabel htmlFor="image">사진</S.RadioLabel> </S.OptionWrapper> <S.ButtonWrapper> <S.SubmitButton isActive={props.isActive} type="submit">{props.isEdit? "수정하기": "등록하기"}</S.SubmitButton> </S.ButtonWrapper> </S.Wrapper> ); } quires.jsimport { gql } from '@apollo/client' export const CREATE_BOARD = gql` mutation createBoard($createBoardInput: CreateBoardInput!) { createBoard(createBoardInput : $createBoardInput){ _id } } ` export const UPDATE_BOARD = gql` mutation updateBoard($updateBoardInput: updateBoardInput!, $password: String, $boardId: ID!) { updateBoard(updateBoardInput: $updateBoardInput, password: $password, boardId: $boardId) { _id } } `container.jsimport { useState } from 'react' import { useForm } from 'react-hook-form'; import { useRouter } from 'next/router'; import { useMutation } from '@apollo/client' import BoardWriteUI from './BoardWriter.presenter'; import { CREATE_BOARD, UPDATE_BOARD } from './BoardWriter.queries'; export default function BoardsWriteContainer(props) { const router = useRouter() const [isActive, setIsActive] = useState(true) const [createBoard] = useMutation(CREATE_BOARD) const [updateBoard] = useMutation(UPDATE_BOARD) const { register, watch, handleSubmit, formState: { errors } } = useForm(); const onChangeWriter = (e) => { e.target.value && watch("password") && watch("title") && watch("contents") ? setIsActive(false) : setIsActive(true) } const onChangePassword = (e) => { e.target.value && watch("writer") && watch("title") && watch("contents") ? setIsActive(false) : setIsActive(true) } const onChangeTitle = (e) => { e.target.value && watch("password") && watch("writer") && watch("contents") ? setIsActive(false) : setIsActive(true) } const onChangeContents = (e) => { e.target.value && watch("password") && watch("title") && watch("writer") ? setIsActive(false) : setIsActive(true) } const onValid = async (data) => { try { const result = await createBoard({ variables: { createBoardInput: { writer: data.writer, title: data.title, password: data.password, contents: data.contents, } } }) console.log(result.data.createBoard._id) alert("게시물이 정상적으로 등록되었습니다.") router.push(`/boards/${result.data.createBoard._id}`) } catch(error) { alert(error.message) } } const onInValid = (error) => { console.log("에러입니다", error) } const onClickUpdate = async (data) => { try { const result = await updateBoard({ variables: { updateBoardInput : { title: data.title, contents: data.contents }, password : data.password, boardId : router.query.boardid, } }) console.log(result) // router.push(`/boards/${router.query.boadid}`) } catch(error) { console.log(error) } } return <BoardWriteUI onValid = {onValid} oninValid = {onInValid} register = {register} handleSubmit = {handleSubmit} errors = {errors} onChangeContents = {onChangeContents} onChangeTitle = {onChangeTitle} onChangePassword = {onChangePassword} onChangeWriter = {onChangeWriter} onClickUpdate = {onClickUpdate} isActive={isActive} isEdit={props.isEdit} /> }
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
fetchUserLoggedIn가 안됩니다 도와주세요
강의를 따라 순서대로 따라했는데마지막에 cannot read property _id 오류가뜹니다ㅠㅠ
-
미해결Slack 클론 코딩[실시간 채팅 with React]
npm warn 은 고치지 않고 넘어가도 되나요?
안녕하세요 질문 드립니다.npm 설치할 때 이러 경고가 나타났는데, 에러는 아니길래 그냥 지나갔는데,로컬호스트3095 들어가면 계속 이러 에러가 나와서 진행이 안 되고 있어요서버는 잘 연결되었습니다
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
안녕하세요 강사님 질문드립니다.
현재 저는 국비학원을 마치고 취업을 준비중 현실을 맞닥들이고 다시 공부를 시작하였습니다. 국비는java를 기반으로 수료했지만 저의 적성이 백엔드보다는 프론트가 맞을 것 같아 본 강의를 구매했습니다. 기본적인 html,css는 이해하고있지만 js는 다소 약한 부분이있습니다.강의를 들으려고 보니 새로 시작한 사람은 새셕23부터 시작하면 된다고 설명이 되어있길래 살펴봤더니 바로 리액트부터 시작하는 것 같았더라구요. js가 다소 약하더라도 따라가는데 어려움이 없을지 질문 드립니다.
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
Quiz 코드
Quiz에 관한 코드는 따로 없을까요?
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 쇼핑몰 사이트 만들기[전체 리뉴얼]
tailwindCss 꼭 사용해야하나요?
tailwindCss 꼭 사용해야하나요? 그냥 css로 사용하고 싶은데 tailwindCss를 사용하지 않으면 강의를 듣는데 문제가 생길까요 ?
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 쇼핑몰 사이트 만들기[전체 리뉴얼]
강의내 eslint부분은 이제 설정하지않아도되는것 아닌가요ㅕ,,?
eslint는 이제 설정하지않아도되는것 아닌가요ㅕ,,?
-
미해결따라하며 배우는 리액트 A-Z[19버전 반영]
영상에서 사용하신 커맨드가 궁금합니다.
섹션 2 할 일 목록 추가하기 영상 3분 4초 부분에서Ctrl + K + F가 아니라면 어떤 커맨드 사용하신 건지 알 수 있을까요?
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
playground createProfile error
오타있는지도 확인하고 껐다가 다시 실행시켜봐도 안됩니다 ㅠ 어떻게 해결해야 하나요?
-
미해결Slack 클론 코딩[실시간 채팅 with React]
워크스페이스 내에서 채널 및 디엠 채팅 시 소켓의 구조가 궁금합니다.
안녕하세요! 강의 정말 잘 듣고 있습니다. 저에게 여러모로 큰 도움이 되고 있는 것 같습니다!다른게 아니라 강의를 들으면서 아직 웹소켓에 대해 잘 몰라서 정확한 로직을 잘 모르겠어서 질문을 드립니다! 소켓을 사용하는 로직이한 클라이언트에 대해 워크스페이스를 바꿀 때 마다 해당 워크스페이스에 대한 소켓을 연결서버는 워크스페이스 별로 소켓을 관리. 채널과 디엠 상관없이 워크스페이스 별로 들어오는 모든 소켓 요청(채팅 내용)을 받아서 전달함클라이언트는 해당 채팅 내용들을 다 받지만 현재 접속해있는 채널이나 dm을 주고 받는 상대에 대한 채팅 내용만 걸러서 화면에 보여줌이렇게 진행되는 것이 맞을까요? 맞다면 혹시 워크스페이스라는 개념이 없이 채팅방만 있거나 1:1 채팅의 기능만 소켓을 사용하여 구현한다고 했을 때는 채팅방 별로 혹은 클라이언트 별로 소켓을 생성해서 구현을 하게 되나요..? 그게 아니라면 보통 어떻게 구현하는지 질문 드리고 싶습니다..! 감사합니다
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
Number 로 변환
const { data } = useQuery(FETCH_BOARD, { // $: { number: 1 }, // variables: { number: Number(router.query.qqq) }, variables: { number: Number(router.query.number) }, }); const { data } = useQuery(FETCH_BOARD, { variables: { boardId: router.query.boardId }, });포트폴리오에서는 router.query 부분을 문자인데 숫자로 왜 변형을 안 시키는 걸까요 ?05-04 수업에서는 router.query.qqq 를 문자니까 Number 로 변환시켜주어 포트폴리오에서도 똑같이 했는데 안되더라고요!
-
미해결파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트
트랜스파일링
2강 14분쯤const add = (x=10, y=20) => x + y + 10console.log(add(1))이 코드는 x = 1, y = 20 해서 31이 출력되야 하는거 아닌가요?
-
미해결처음 만난 리액트(React)
12 강 props.onTemoeratureChange() 함수 질문
props.onTemperatureChange()함수는 정의해 놓지 않았는데 onTemperatureChange()함수는 어디에서 제공해준 함수 인가요?
-
미해결처음 만난 리액트(React)
12강 props.onTemperatureChange() 함수 질문
setTemperature() 함수 대신 props.onTemperatureChange() 함수를 사용 했는데~요onTemperatureChange() 함수는 state에 없는데 이 함수는 어디에서 제공 해주는지 잘 모르겠습니다
-
미해결[리뉴얼] React로 NodeBird SNS 만들기
버전 문의
버전 문의있습니ㄷㅏ.지금 최신버전으로 만ㄷㅡㄹ고싶으면 제로초님의 github에서 ch7을 보면 ㄷㅚㄹ까요?
-
해결됨처음 만난 리덕스(Redux)
createStore()와 combineReducers()에 대한 질문
각각의 todoReducer, memoReducer에 initialState를 전달하는 방법말고 createStore() 함수의 2번째 인자로 preloadedState를 전달하는 방법은 없나요?const preloadedState = { todo: initialTodoState, memo: initialMemoState, }; const store = createStore( rootReducer, preloadedState, applyMiddleware(loggerMiddleware), );(추가) 위와 같이 작성 후(각 reducer의 초기 상태 전달 안함), 애플리케이션이 동작하지 않더라구요..!(추가) 해서 GPT에게 물어봤습니다! 그랬더니 답변으로이 방법을 사용하면 preloadedState를 통해 전체 앱의 초기 상태를 한 곳에서 관리할 수 있어 유용합니다. 하지만 이 방법은 각 리듀서에서 초기 상태를 설정하는 방법과 병행해서 사용해야 합니다. 왜냐하면 preloadedState는 앱이 시작될 때 한 번만 사용되고, 그 이후에는 각 리듀서에서 정의한 초기 상태가 사용되기 때문입니다.해서 각 reducer에도 각각의 initialState 배열을 전달하니 동작은 하긴 하는데, 이럴꺼면 굳이 preloadedState를 전달하는 의미가 없는 것 같아서 조금 헷갈리네요..!결론적으로 질문은 아래와 같습니다..!1) 각 reducer에게 초기 상태를 전달하지않고 combine한 reducer를 createStore에 전달할 때, 초기 상태를 전달해서 사용하는 방법이 있나요?
-
해결됨[리뉴얼] React로 NodeBird SNS 만들기
서버사이드렌더링 쿠키저장시 리덕스에 있는 state에 action.data가 새로고침시에 사라짐
로그인시에 서버사이드렌더링으로 쿠키가 저장되고 공유하는건 확인이 됐습니다. 헤드에 저장이 되어 쿠키 저장이 된건 확인이 됐는데 로그인시 리덕스에서 me값으로 action.data가 전달되는데 왜 새로고침시에 state 인 me값이 왜 null 값으로 바뀌는걸까요.. 이것도 서버사이드 렌더링으로 유지가 가능할까요? 여러페이지를 만들시에 페이지이동시에도 처음 로그인시에 me 로 넘겨주는 action.data 값도 유지하고 싶습니다
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
css-in-js 방식에 대해
질문1. 앞으로의 강의를 css-in-js 방식으로 진행하신다고 하셨는데 실무에서 기존 css 방식으로 사용할땐 코드 작성법을 따로 공부해야 할까요?질문2. css-in-js 방식을 사용했을때 지원종료는 했지만 아직 ie11버전을 맞추는 고객들이 있는데 그 경우에서도 사용이 가능한가요?질문3. css-in-js 방식을 사용했을때 - 유지보수나,- 웹접근성 표준, - 그리고 일반적으로 id나class 값을 부여하지 않아도 되는 요소에 들어가는 이름의 용량같은 버려지는 용량에 대한 부분에 있어서 기존 css 보다 알맞고?(적절하고?) 좋은가요 아니면 단순히 작성자의 편의를 위해 사용하는 건가요?