inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

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

CSR에서 window나 document를 접근할수 없다는 부분이 이해가 잘 안갑니다.

해결됨

Next.js 시작하기(feat. 지도 서비스 개발)

CSR 부분 강의를 듣던도중 useEffect 바깥에서 window나 document를 접근하는 경우 문제가 되는것을 알게 되었습니다. 강의에서는 초기에 값이 들어있지않은 html을 프리렌더링해서 제공한다고 설명하고 있는데 이부분에서 의문점이 있습니다. 1. 제가 기존에 알고있던 CSR은 프리렌더링을 하지 않는걸로 알고 있었는데 그러면 결국 프리렌더링 이라는것은 SSR SSG ISR CSR 까지 모두 적용되고있는 방식인가요? 2. 프리렌더링을 하는것이 맞다면, 저같은 경우 일전에 했던 리액트 프로젝트를 정적 파일을 저장하는 aws S3에 배포해본적이 있는데 이것이 가능했던 이유가 서버에서 렌더링을 진행하기 않기때문에 가능한것이라고 알고 있었습니다. 그렇다면 S3에서 CSR만 적용된 리액트 프로젝트를 배포할수있는 이유는 무엇인가요?

  • seo
  • next.js
  • vercel
  • csr
  • ssg
  • ssr
kenny 댓글 1 좋아요 1 조회수 377

보안 관점에서의 SSR과 CSR 선택지

해결됨

Next.js 시작하기(feat. 지도 서비스 개발)

개인정보 페이지같은 보안이 중요한경우 CSR보다 SSR을 적용하는게 좋다고 하셨는데 오히려 검색엔진의 정보수집때문에(SEO) 개인정보를 노출할수도 있지 않나요? 검색을 해보니 이런 주장을 하는 분들도 계셔서요 요청을 최소화 하냐 vs 정보수집에 노출되지 않도록 하냐 이 두개의 충돌같은데 어떻게 생각하시는지 궁금합니다.

  • seo
  • next.js
  • vercel
  • csr
  • ssg
  • ssr
kenny 댓글 1 좋아요 1 조회수 541

state is not defined 에러가 뜹니다

해결됨

[리뉴얼] React로 NodeBird SNS 만들기

이 에러는 왜 발생한 건가요? 구글에 검색도 해봤는데 안나오네요 도와주세요 ㅠ reducers/user.js 코드입니다 export const initialState = { } export const loginAction = (data) => { return { type: 'LOG_IN', data, } } export const logoutAction = () => { return { type: 'LOG_OUT', } } const reducer = (State = initialState, action) => { switch (action.type) { case 'LOG_IN': { return { ...state, isLoggedIn: true, user: action.data, }; } case 'LOG_OUT': { return { ...state, isLoggedIn: false, user: null, }; } default: return state; } }; export default reducer; 터미널창 오류 메세지 입니다 error - reducers/user.js (37:12) @ reducer error - ReferenceError: state is not defined at reducer (webpack-internal:///./reducers/user.js:39:13) at /Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:476:24 at Array.forEach (<anonymous>) at assertReducerShape (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:474:25) at combineReducers (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:539:5) at eval (webpack-internal:///./reducers/index.js:15:75) at Object../reducers/index.js (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/pages/_app.js:33:1) at __webpack_require__ (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/webpack-runtime.js:33:42) at eval (webpack-internal:///./store/configureStore.js:9:67) at Object../store/configureStore.js (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/pages/_app.js:66:1) { page: '/' } 35 | } 36 | default: > 37 | return state; | ^ 38 | 39 | } 40 | }; event - compiled client and server successfully in 100 ms (1518 modules) 4. WrappedApp created new store with withRedux(NodeBird) { initialState: undefined, initialStateFromGSPorGSSR: undefined } ReferenceError: state is not defined at reducer (webpack-internal:///./reducers/user.js:39:13) at /Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:476:24 at Array.forEach (<anonymous>) at assertReducerShape (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:474:25) at combineReducers (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:539:5) at eval (webpack-internal:///./reducers/index.js:15:75) at Object../reducers/index.js (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/pages/_app.js:33:1) at __webpack_require__ (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/webpack-runtime.js:33:42) at eval (webpack-internal:///./store/configureStore.js:9:67) at Object../store/configureStore.js (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/.next/server/pages/_app.js:66:1) http://localhost:3060 에 뜬 오류 입니다 Server Error ReferenceError: state is not defined This error happened while generating the page. Any console logs will be displayed in the terminal window. Source reducers/user.js (35:12) @ reducer 33 | } 34 | default: > 35 | return state; | ^ 36 | 37 | } 38 | };

  • react
  • redux
  • node.js
  • express
  • next.js
정현영 댓글 1 좋아요 0 조회수 730

ApolloError: null value in column "writer" of relation "board" violates not-null constraint

해결됨

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

하드코딩으로 값을 넣었을때는 잘진행이 되었는데요ㅠㅠ 안에 값을 지정하니 에러가 계속뜨네요 아마 이 부분 에서 고쳐야 할 점이 있는 것 같은데 똑같이 작성을 한 것 같음에도 동작이 안되서 질문드려봅니다

  • react
  • node.js
  • seo
  • graphql
  • next.js
김윤원 댓글 2 좋아요 0 조회수 576

윈도우 WSL 에서 yarn dev 후에 수정한 index.js 반영

해결됨

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

브라우저에서 새로고침해도 수정된 index.js가 반영이 안되던데 왜그러는걸까요 ㅠ

  • react
  • node.js
  • seo
  • graphql
  • next.js
메오 댓글 1 좋아요 0 조회수 460

최종변환?

해결됨

처음 만난 리액트(React)

jsx강의 에서는 jsx는 내부적으로 html/xml코드를 자바스크립트로 변환하는 과정 을 거치게 된다. 그래서 최종적으로는 자바스크립트 코드로 나오게 된다. 이렇게 말씀해주시고 jsx코드를 자바스크립트 코드로 변환하게 해주는 것이 react.createElement라고 하셨는데, 여기 강의 에서는 5분 35초 부근에 react.createElement 내부에 리액트 컴포넌트를 적어도 되고 모든 리액트 컴포넌트는 최종적으로는 html 태그를 사용하게 돼있다라고 하셨습니다. react.createElement를 통해서 최종적으로 자바스크립트가 된다는건가요? 아니면 html 코드가 된다는건가요,,?ㅠㅠ

  • HTML/CSS
  • javascript
  • react
sohee 댓글 1 좋아요 0 조회수 449

훈훈한 자바스크립트 반복문파트 스크립트 태그의 위치 질문

해결됨

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

저는 버튼을 누르면 텍스트 출력은 오류, 콘솔 출력은 null이 뜹니다 원인이 뭐죠? index.html <!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>D-Day-count</title> <link rel="stylesheet" href="./style.css" /> <script src="./script.js"></script> </head> <body> <h1>D-Day</h1> <div id="d-day-container"> <div class="d-day-child-container"> <span id="days">0</span> <span>일</span> </div> <div class="d-day-child-container"> <span id="hours">0</span> <span>시간</span> </div> <div class="d-day-child-container"> <span id="min">0</span> <span>분</span> </div> <div class="d-day-child-container"> <span id="sec">0</span> <span>초</span> </div> </div> <div id="d-day-meassage"></div> <div id="target-selector id"> <input id="target-year-input" class="target-input" size="5" /> - <input id="target-month-input" class="target-input" size="5" /> - <input id="target-date-input" class="target-input" size="5" /> </div> <button onclick="counterMaker()" id="start-btn">카운트다운 시작</button> </body> </html> script.js // const obj = { // name: "Jason", // age: 25, // }; // if (obj.name === "Jason" || obj.age === 25) { // console.log("안녕, " + obj.name + ", 너의 나이는 " + obj.age); // } else { // console.log("넌 우리 멤버가 아니다."); // } const dateFormMaker = function () { const inputYear = document.querySelector("#target-year-input").value; const inputMonth = document.querySelector("#target-month-input").value; const inputDate = document.querySelector("#target-date-input").value; // const dateFormat = inputYear + '-' + inputMonth + '-' + inputDate; const dateFormat = `${inputYear}-${inputMonth}-${inputDate}`; //템플릿 리터럴 return dateFormat; }; const counterMaker = function () { const messageContainer = document.querySelector("#d-day-message"); console.log(messageContainer); messageContainer.textContent = "D-Day를 입력해주세요."; const targetDateInput = dateFormMaker(); const nowDate = new Date(); const targetDate = new Date(targetDateInput).setHours(0, 0, 0, 0); const remaining = (targetDate - nowDate) / 1000; // 만약, remaining === 0 라면, 타이머가 종료되었습니다. 출력 if (remaining <= 0) { console.log("타이머가 종료되었습니다."); } else if (isNaN(remaining)) { //만약, 잘못된 날짜가 들어왔다면, 유효한 시간대가 아닙니다. 출력 console.log("유효한 시간대가 아닙니다."); } const remainingDate = Math.floor(remaining / 3600 / 24); //몇일 남았는지 구하기 const remainingHours = Math.floor(remaining / 3600) % 24; //몇 시간 남았는지 구하기 const remainingMin = Math.floor(remaining / 60) % 60; //몇 분 남았는지 구하기 const remainingSec = Math.floor(remaining) % 60; //몇 초 남았는지 구하기 console.log(remainingDate, remainingHours, remainingMin, remainingSec); };

  • react
  • node.js
  • seo
  • graphql
  • next.js
전현욱 댓글 1 좋아요 0 조회수 451

3분 쯤에 자바스크립트 파일을 캐시한다는 의미가 궁금합니다.

해결됨

Next.js 시작하기(feat. 지도 서비스 개발)

먼저 좋은 강의 해주셔서 감사합니다. 궁금한 점은 CSR이 자바스크립트 파일을 캐시한다고 하셨는데 여기서의 캐시가 브라우저가 state값을 계속 가지고 있다는 것인지 아니면 브라우저가 js파일을 가지고 계속 동적으로 렌더링 할 때 사용한다는 의미인가요? 둘 다 아니라면 캐시의 의미가 궁금합니다. 다시 한 번 좋은 강의 감사드려요

  • seo
  • next.js
  • vercel
  • csr
  • ssg
  • ssr
이종민 댓글 2 좋아요 1 조회수 402

회원가입 과제

해결됨

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

안녕하세요! 회원가입 과제를 풀다가 막혀서 더 이상 진도를 못 나가고 있는 상황입니다. 섹션 7에 파이널 과제를 참고 하라고 하셨는데 회원가입 과제는 섹션7과 다르게 입력칸이 밑줄이라서 어떤 식으로 코드를 쳐야할지 감도 안 오는 상황입니다. 참고식이 아닌 회원가입 과제 부분 코드를 보고 싶은데 혹시 제가 정답 코드를 못 찾는거라면 링크를 첨부해주실 수 있으실까요?

  • react
  • node.js
  • seo
  • graphql
  • next.js
귀여운 캥거루 댓글 2 좋아요 0 조회수 463

싸이월드 만들기1탄 이미지 삽입이 이상합니다.

해결됨

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

저는 왜이렇게 나오는걸까요...코드 여러번 재작성 해도 저렇게 나옵니다..ㅠ background-color 넣었을땐 정상적으로 나옵니다..왜 저러는건가요..? 그리구 .outerbox 코드에 "outerbox": Unknown word. 가 발생합니다.

  • react
  • node.js
  • seo
  • graphql
  • next.js
우영호 댓글 3 좋아요 0 조회수 1229

강의 들으면서 같이 볼만한 책이나 교재 같은게 있을까요?

해결됨

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

항상 좋은 강의 감사합니다. 다름이 아니라 혹시 강의 들으면서 같이 볼만한 책이나 교재 같은게 있을까요?

  • react
  • node.js
  • seo
  • graphql
  • next.js
지우혁 댓글 1 좋아요 0 조회수 327

vite-plugin-next-react-router

미해결

풀스택 리액트 라이브코딩 - 간단한 쇼핑몰 만들기

vite-plugin-next-react-router 다운받고 강의를 따라했는데요.. routes.tsx파일이 자동으로 생성이 되지않습니다. 그런데 이상하게 페이지가 작동이되요.. 이유가 뭘까요..? vite.config.ts 내용은 조금 다릅니다.reactRouterPlugin를 사용하면 오류가 생겨서 withReactRouter 으로 교체했습니다. 나머지 파일생성과 코드는 동일합니다.. import { defineConfig } from "vite"; import withReactRouter from "vite-plugin-next-react-router"; import react from "@vitejs/plugin-react"; export default defineConfig({ plugins: [react(), withReactRouter()], });

  • react
  • firebase
  • graphql
Nuri Park 댓글 3 좋아요 0 조회수 1504

(해결/오타문제) addPost 액션이 동작하지 않는 것에 대해 궁금합니다.

해결됨

[리뉴얼] React로 NodeBird SNS 만들기

안녕하세요. 항상 좋은 강의를 해주셔서 감사합니다. 다름이 아니라 글 작성시 콘솔에 ADD_POST_REQUEST에 대한 리듀서 작동은 확인했으나 그 뒤에 addPost 사가가 작동하지 않는 것에 대해 질문이 있습니다. 위 문제는 watchAddPost()가 정상적으로 ADD_POST_REQUEST에 대한 이벤트를 캐치하지 못 해서 다음 과정이 진행되지 않는 것이라고 생각합니다. 다만 콘솔에서는 이에 대한 것도 뜨지 않아 해당 오류를 해결하기 어려워 질문 드립니다. 다음은 제가 작성한 코드입니다. () @/component/PostFrom.js const PostForm = () => { const dispatch = useDispatch(); const { imagePaths, addPostDone } = useSelector((state) => state.post); const [text, onChangeText, setText] = useInput(""); const onSubmit = useCallback(() => { dispatch(addPostRequestAction(text)); }, [text]); ... } @/reducer/post.js export const initialState = { mainPosts: [...], ... addPostLoading: false, addPostDone: false, addPostError: null } export const ADD_POST_REQUEST = "ADD_POST_REQUEST"; export const ADD_POST_SUCCESS = "ADD_POST_SUCCESS"; export const ADD_POST_FAILURE = "ADD_POST_FAILURE"; export const addPostRequestAction = (data) => ({ type: ADD_POST_REQUEST, data, }); const dummyPost = (data) => ({ id: 2, content: data, User: { id: 1, nickname: "윤섭", }, Images: [], Comments: [], }); const reducer = (state: initialState, action) => { switch (action.type) { case ADD_POST_REQUEST: console.log("REDUCER: ADD_POST_REQUEST"); return { ...state, addPostLoading: true, addPostDone: false, addPostError: null, }; case ADD_POST_SUCCESS: console.log("REDUCER: ADD_POST_SUCCESS"); return { ...state, mainPosts: [dummyPost(action.data), ...state.mainPosts], addPostLoading: false, addPostDone: true, }; ... } } @/sagas/post.js import { all, fork, delay, put, takeLatest } from "redux-saga/effects"; import axios from "axios"; import { ADD_POST_REQUEST, ADD_POST_SUCCESS, ADD_POST_FAILURE, ADD_COMMENT_REQUEST, ADD_COMMENT_SUCCESS, ADD_COMMENT_FAILURE, } from "@/reducers/post"; // add post function addPostAPI(data) { return axios.post("/api/post"); } function* addPost(action) { try { // const result = yield call(addPostAPI); yield delay(1000); console.log("SAGA: addPost"); yield put({ type: ADD_POST_SUCCESS, data: action.data, }); } catch (err) { yield put({ type: ADD_POST_FAILURE, error: err.response.data, }); } } function* watchAddPost() { yield takeLatest(ADD_POST_REQUEST, addPost); } export default function* postSaga() { yield all([fork(watchAddPost), fork(watchAddComment)]); } 아래는 ADD_POST_REQUEST 이후 아무런 반응이 없는 스크린샷입니다.

  • react
  • redux
  • node.js
  • express
  • next.js
윤섭 댓글 2 좋아요 0 조회수 386

내장함수 타이머 작동 질문

해결됨

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

작성된 코드는 똑같은데 타이머가 작동하지 않아요 ㅠㅠ min과 sec 두 변수 모두 String으로 감싸줘보기도 하고 min "+" sec 부분을 String으로 감싸주기도 해봤는데 해결이 안돼요 let auth = () => { const token = String(Math.floor(Math.random() * 1000000)).padStart(6, "0"); document.getElementById("number").innerText = token; document.getElementById("number").style.color = "#" + token; let time = 180; setInterval(function () { if (time >= 0) { let min = Math.floor(time / 60); let sec = Stirng(time % 60).padStart(2, "0"); document.getElementById("timer").innerText = min + ":" + sec; time = time - 1; } else { document.getElementById("finish").disabled = true; } }, 1000); };

  • react
  • node.js
  • seo
  • graphql
  • next.js
댓글 1 좋아요 0 조회수 375

getServerSideProps cache가 되지 않을 때

해결됨

Next.js 시작하기(feat. 지도 서비스 개발)

안녕하세요 강사님. getServerSideProps 강의를 보고 실습중에 캐시가 되지 않아 질문드립니다. 다음과 같이 코드를 작성하고, getServerSideProps 페이지에서 로드된 html 문서의 헤더를 보면 캐시 정보가 나오지 않고 캐시가 되지 않는데 이유를 알 수 있을까요..? import type { GetServerSideProps, NextPage } from 'next'; type Props = { data: number; }; const Example: NextPage<Props> = ({ data }) => { return ( <main> <h1>getServerSideProps Page!</h1> <p>값: {data}</p> </main> ); }; export default Example; export const getServerSideProps: GetServerSideProps = async ({ res }) => { res.setHeader( 'Cache-Control', 'public, s-maxage=5, stale-while-revalidate=10' ); const delayInSeconds = 2; const data = await new Promise((resolve) => setTimeout(() => resolve(Math.random()), delayInSeconds * 1000) ); return { props: { data }, }; };

  • seo
  • next.js
  • vercel
  • csr
  • ssg
  • ssr
crewsade 댓글 1 좋아요 1 조회수 642

firebase 업데이트

해결됨

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

강사님 안녕하세요! 다름이 아니라 firebase 데이터 업데이트 하는 부분이 막혀 질문하려고 합니다. 아래 사진은 Firebase 데이터 업데이트 함수와 발생하는 에러 사진입니다. 해당 문제를 해결할 수 있게 도움 부탁드립니다 ㅠㅠ 해당 오류 해결하기 위해 firebase 룰을 변경했는데도 해결되지 않았습니다.

  • react
  • node.js
  • seo
  • graphql
  • next.js
병아리222 댓글 1 좋아요 0 조회수 463

PDF파일이 어디에 있나요?

해결됨

Python 알고리즘 베스트 10

안녕하세요 PDF파일은 출력하려고 하는데, 노션을 보면 "PDF 노션 페이지에서 다운로드하실 수 있습니다." 로만 되어있는데 다운받을 수 있는 링크는 어디에 있나요? 노션에서 전체PDF출력하려면 비지니스라서 불가능한데... 확인부탁드립니다.

  • python
  • 코딩-테스트
한형섭 댓글 2 좋아요 0 조회수 486

npm run dev 오류가 뜹니다

해결됨

[리뉴얼] React로 NodeBird SNS 만들기

http://localhost:3000/에 뜬 오류 Server Error TypeError: Cannot read properties of undefined (reading 'user') This error happened while generating the page. Any console logs will be displayed in the terminal window. Source components/AppLayout.js (15:52) @ eval 13 | 14 | const AppLayout = ({ children }) => { > 15 | const isLoggedIn = useSelector((state) => state.user.isLoggedIn); | ^ 16 | // const { isLoggedIn } = useSelector(state => state.user); 17 | 18 | return ( Call Stack AppLayout components/AppLayout.js (15:36) Show collapsed frames 터미널에 뜬 오류 TypeError: Cannot read properties of undefined (reading 'user') at eval (webpack-internal:///./components/AppLayout.js:32:101) at /Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/react-redux/lib/hooks/useSelector.js:67:26 npm run dev를 하고 http://localhost:3000/ 들어갔더니 이런 오류가 뜨면서 안됩니다. 유저를 왜 읽지 못하는 걸까요? 오류 해결하고 싶습니다 ㅠ

  • react
  • redux
  • node.js
  • express
  • next.js
정현영 댓글 1 좋아요 0 조회수 791

인기 태그

인프런 TOP Writers

주간 인기글