inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

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

TypeError: rt.toLowerCase is not a function 및 Compiling 무한 로딩

미해결

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

▲ Next.js 14.2.1 - Local: http://localhost:3000 ✓ Starting... ✓ Ready in 5.2s ○ Compiling / ... ✓ Compiled / in 5.5s (583 modules) GET / 200 in 5896ms TypeError: rt.toLowerCase is not a function at C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:30:274042 at finishResolved (C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:3:192383) at C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:3:193267 at C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:3:194059 at eval (eval at create (C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:15:28858), <anonymous>:12:1) ... at C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:3:194059 at eval (eval at create (C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:15:28858), <anonymous>:13:1) at C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:3:194059 at eval (eval at create (C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:15:28858), <anonymous>:12:1) at C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bundle5.js:3:204068 at Hook.eval [as callAsync] (eval at create (C:\Users\KimByeongHwa\Desktop\inflearn\z-com\node_modules\next\dist\compiled\webpack\bund ○ Compiling /home ... 화면이 버벅거릴 정도로 에러 코드가 길어서 어쩔 수 없이 잘라서 올립니다. < 현재 상황 > npm run dev 하면 바로 TypeError: rt.toLowerCase is not a function 에러가 발생합니다. 에러가 발생해도 첫 랜딩 화면은 렌더링 됩니다. 그러나 주소창에 url 입력하여 페이지 이동 시 에러 코드 맨 마지막 줄 처럼 무한 로딩이 걸리고 아무 것도 안됩니다. < 시도 해 본 것> https://stackoverflow.com/questions/78321779/typeerror-rt-tolowercase-is-not-a-function-nextjs 를 따라 npm 재설치 => 실패 프로젝트 폴더 삭제 후 재설치 => 실패 다른 구글링 자료를 보면 13버전을 사용하라고 하는데, 14버전 강의를 듣기에 적용할 수 없는 해결책

  • react
  • next.js
  • react-query
  • next-auth
  • msw
김병화 댓글 2 좋아요 0 조회수 371

LoginButton 컴포넌트에서 useSession 오류

미해결

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

강의 3:53초 부분에 회원가입을 하자마자 로그인을 하면 useSession에 값이 제대로 들어오지 않는다고 하셨는데 라이브러리 자체 오류인가요 아니면 onSubmit에서 회원가입 플로우 직후 redirect("/home")하는 부분이 영향을 받아서 그런건가요?

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

제로초님 안녕하세요 ㅎㅎ 질문이 있습니다 ㅎㅎ

미해결

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

react-query에서 하나의 궁금 증이 있는데 제가 아직 다 안봐서 헷갈릴 수도 있긴 하겠지만 prefetchQuery의 경우는 post, pus, delete 등의 메소드 일때는 사용 하지 않고 대부분 get일때만 사용 하나요?! post, pus, delete 의 메소드들은 Mutation으로 사용 된다고 생각 하면 될까요?! 헷갈리네요 ㅠㅠ prefetchQuery말고 axios 와 같은 라이브러리를 붙여서 사용 해도 될까요?! fatch 를 사용 하셔서 한번 여쭤 봅니다 ㅎㅎ

  • react
  • next.js
  • react-query
  • next-auth
  • msw
김로인 댓글 1 좋아요 0 조회수 372

Suspense 동작 질문드립니다.

미해결

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

Suspense 컴포넌트를 아래처럼 TabDeciderSuspense 컴포넌트 안에 포함시켰더니 데이터 페칭하는 동안 Tab, PostForm 컴포넌트가 로딩 스피너 때문에 보이지 않던데 Suspense 컴포넌트는 데이터 페칭하는 컴포넌트 밖으로 무조건 빼야 제대로 동작하는 건가요? <Suspense fallback={"Loading..."}> <HydrationBoundary state={dehydratedState} queryClient={queryClient}> <TabDecider /> </HydrationBoundary> </Suspense>

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

reducer설정 중 user 초기값이 undefined로 나오는 에러

미해결

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

안녕하십니까 형님 진행하다 보니 궁금한게 생겨서 여쭤보려고 합니다. reducer설정 중 초기값이 undefined로 들어오는 에러가 놔왔었는데욥 error - Error: The slice reducer for key "user" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined. 에러 났던 부분운 default: state 이 부분이고 코드 보고 아래처럼 수정하니 잘 동작했습니다. export const initialState = { isLoggedIn: false, user: null, signUpData: {}, loginData: {}, } const reducer = (state=initialState, action) => { switch(action.type) { default: { return { ...state } } } } default: state vs default: { return {...state}} 문법적으로 똑같은 내용이 아닌지...어떤 차이가 있는지를 모르겠어서 질문드립니다!

  • react
  • redux
  • node.js
  • express
  • next.js
이민성 댓글 2 좋아요 0 조회수 333

css <Link>와 <img>크기 지정

미해결

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

제로초님이 강의 하시다 Link태그 안에 img 태그를 넣는 방식으로 하시다가 사진 두개를 넣는 부분 부터 이작업을 안하셨는데 두번 째 방식까지는 .postImageSection img { border-radius: 16px; height: 100%; width: 100%; } img 태그에 100%를 주는 방법으로 해결했지만 그림 3개를 넣는 부분 부터는 크기가 맞지 않습니다 어떻게 해결하면 크기가 정확히 맞을까요? if (post.Images.length === 3) { return ( <div className={cx(style.postImageSection, style.threeImage)}> <Link href={`/${post.User.id}/status/${post.postId}/photo/${post.Images[0].imageId}`} style={{ backgroundImage: `url(${post.Images[0]?.link})`, backgroundSize: "cover", }} > <img src={post.Images[1]?.link} alt="" /> </Link> <div> <Link href={`/${post.User.id}/status/${post.postId}/photo/${post.Images[1].imageId}`} style={{ backgroundImage: `url(${post.Images[1]?.link})`, backgroundSize: "cover", }} > <img src={post.Images[1]?.link} alt="" /> </Link> <Link href={`/${post.User.id}/status/${post.postId}/photo/${post.Images[2].imageId}`} style={{ backgroundImage: `url(${post.Images[2]?.link})`, backgroundSize: "cover", }} > <img src={post.Images[2]?.link} alt="" /> </Link> </div> </div> );

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

네이버 메일 자동화 실습 문의

해결됨

[신규 개정판] 이것이 진짜 엑셀자동화다 - 기본편

안녕하세요 네이버 메일 자동화 코드를 실행하면 메일 쓰기 버튼을 계속 찾지 못하고 있어 어떻게 수정하면 될지 문의드립니다. 메일함 이동까지는 정상적으로 되고 있으나 메일 쓰기 버튼만 찾지 못하고 있습니다. 코드는 다음과 같습니다. from selenium.webdriver import ChromeOptions from selenium import webdriver from selenium.webdriver.chrome.service import Service as ChromeService from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By import time import pyperclip import pyautogui from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC options = ChromeOptions() options.add_experimental_option("detach", True) driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=options) driver.get('https://nid.naver.com/nidlogin.login?mode=form&url=https://www.naver.com/') driver.maximize_window() # 화면 최대화 # 아이디 입력창 id = driver.find_element(By.CSS_SELECTOR, '#id') id.click() pyperclip.copy('eooe5173') pyautogui.hotkey('ctrl', 'v') time.sleep(2) # 비밀번호 입력창 passward = driver.find_element(By.CSS_SELECTOR, '#pw') passward.click() pyperclip.copy('ssw471395~') pyautogui.hotkey('ctrl', 'v') time.sleep(2) # 로그인 버튼 driver.find_element(By.CSS_SELECTOR, '#log\.login').click() time.sleep(5) # 메일함으로 이동 mailbox = driver.find_element(By.CSS_SELECTOR,'#shortcutArea > ul > li:nth-child(1) > a').click() time.sleep(5) # 내게 쓰기 버튼 writeme_button =driver.find_element(By.CSS_SELECTOR, '#root > div > nav > div > div.lnb_header > div.lnb_task > a.item.button_write').click() # 메일 제목 입력창 및 입력 mailname = driver.find_element(By.CSS_SELECTOR, '#subject_title').click() pyperclip.copy('안녕하세요') pyautogui.hotkey('ctrl', 'v') time.sleep(5) # 메일 내용 입력창 및 입력 mailinfo = driver.find_element(By.CSS_SELECTOR, '#body > div > div.workseditor-content').click() pyperclip.copy('네이버 메일 자동화입니다.') pyautogui.hotkey('ctrl', 'v') time.sleep(5) # 메일 저장 mailsave = driver.find_element(By.CSS_SELECTOR, '#content > div.mail_toolbar.type_write > div:nth-child(1) > div > button.button_write_task').click() time.sleep(5) 에러는 동일하게 다음과 같이 노출되고 있습니다. selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"#root > div > nav > div > div.lnb_header > div.lnb_task > a.item.button_write"} (Session info: chrome=123.0.6312.123) Stacktrace: GetHandleVerifier [0x00D14CA3+225091] (No symbol) [0x00C44DF1] (No symbol) [0x00AE9A7A] (No symbol) [0x00B2175B] (No symbol) [0x00B2188B] (No symbol) [0x00B57882] (No symbol) [0x00B3F5A4] (No symbol) [0x00B55CB0] (No symbol) [0x00B3F2F6] (No symbol) [0x00B179B9] (No symbol) [0x00B1879D] sqlite3_dbdata_init [0x01189A43+4064547] sqlite3_dbdata_init [0x0119104A+4094762] sqlite3_dbdata_init [0x0118B948+4072488] sqlite3_dbdata_init [0x00E8C9A9+930953] (No symbol) [0x00C507C4] (No symbol) [0x00C4ACE8] (No symbol) [0x00C4AE11] (No symbol) [0x00C3CA80] BaseThreadInitThunk [0x764EFCC9+25] RtlGetAppContainerNamedObjectPath [0x77DE7C5E+286] RtlGetAppContainerNamedObjectPath [0x77DE7C2E+238]

  • python
  • selenium
  • openpyxl
댓글 1 좋아요 0 조회수 401

강의 활용 방안에 대한 질문 (일단 강의만 쭉 듣는 방향은 어떤지)

미해결

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

제로초님 안녕하세요. 강의 활용 방안에 대해서 간단한 질문이 있어서 글 남깁니다. 제가 해당 강의를 듣는 이유는 Next.js에 대한 학습이며 이와 더불어 추가적으로 활용하시는 기술 (웹소켓 등) 을 함께 학습하는 것이며, 최대한 빠르게 개념을 잡고 혼자서 사이드 프로젝트 등을 만들며 익숙해지는 것이 목적입니다. 본래는 강의 초반부에 추천해주신 것처럼 일정 부분 강의를 수강한 후 올려주시는 예시 코드를 바탕으로 직접 코드를 짜며 비교해보는 방식으로 활용해보려 했습니다. 하지만 해당 방식에 다소 불편함이 있어서 (ex. 올려주신 예시 코드에서도 로그인/아웃 기능이 구현되지 않은 상황이라 화면 구현하는데 다소 불편함이 따르는 등) 먼저 강의를 보기만 하는 식으로 완강한 후 배운 내용을 바탕으로 혼자서 구현해보는 방식으로 활용해보려 합니다. 관련하여 혹시 보다 추천하시는 방법이 있으신지 궁금해서 질문글 남기게 되었습니다.

  • react
  • next.js
  • react-query
  • next-auth
  • msw
김영학 댓글 1 좋아요 0 조회수 288

React-query 부분에서 질문이 있습니다.

미해결

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

강의 언제나 잘보고 있습니다. 따로 작업하다가 난감한게 있어서 문의드립니다. 예를 들어 ["ABC"] 라는 캐시가 있다는 가정하에 A페이지, B페이지에서 해당 캐시를 사용합니다. 이때 질문이 있습니다. A,B 페이지에서 useQuery로 데이터를 불러올 경우 실수로 A와 B가 다른 queryFn이 정의 되어있을 때, InvalidateQueries를 해도 데이터가 미스매칭될 수 있는 가능성이 존재할까요? prefetchQuery 사용 시, A페이지와 B페이지가 ABC라는 데이터가 공통으로 필요할 경우, A페이지에서 prefetchQuery를 읽어서 B로 가면 A의 ABC를 캐시해서 B에서도 사용 가능한 걸로 알고있는데요. 이럴때 만일 B페이지로 바로 접근이 가능할 경우, B 페이지에서도 prefetchQuery를 적용해야 둘다 SSR이 제대로 적용되는걸까요?

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

input type="radio" 에서 ref의 적절한 사용법

해결됨

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

안녕하세요 선생님. 이번 강좌에서 숙제로 내주신 부분(div로 radio버튼 만들기) 을 진행하다가 문득 궁금증이 생겼는데요. <input type="radio">가 많을때 useRef을 하나씩 만들어서 일일이 1대1 매칭으로 접근해야 하는건가요? 혹은 ref값을 빈배열로 만든 뒤 배열의 값을 radio 버튼의 value로 채워서 해당 배열의 인덱스 값으로 참조해야하는 걸까요?

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

use server를 클라이언트 컴포넌트에서 사용시 에러

미해결

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

안녕하세요 섹션3의 3번째 강의 server action을 보고 있는데요 const submit에서 에러가 발생해서 질문합니다. const submit에서 서버액션을 사용하기 위해 "use server"를 넣었는데 다음과 같은 에러가 발생합니다. ./src/app/(beforeLogin)/_component/SignupModal.tsx Error: × It is not allowed to define inline "use server" annotated Server Actions in Client Components. │ To use Server Actions in a Client Component, you can either export them from a separate file with "use server" at the top, or pass them down through props from a Server Component. │ │ Read more: https://nextjs.org/docs/app/api-reference/functions/server-actions#with-client-components │ ╭─[/home/tpark/SNS/z-com/src/app/(beforeLogin)/_component/SignupModal.tsx:3:1] 3 │ import { redirect } from "next/navigation"; 4 │ 5 │ export default function SignupModal() { 6 │ ╭─▶ const submit = async (formData: FormData) => { 7 │ │ "use server"; 8 │ │ if (!formData.get("id")) { 9 │ │ return "아이디를 입력하세요."; 10 │ │ } 11 │ │ if (!formData.get("name")) { 12 │ │ return "닉네임을 입력하세요."; 13 │ │ } 14 │ │ if (!formData.get("password")) { 15 │ │ return "비밀번호를 입력하세요."; 16 │ │ } 17 │ │ if (!formData.get("image")) { 18 │ │ return "이미지를 업로드하세요."; 19 │ │ } 20 │ │ if (!formData.get("id")) { 21 │ │ return "이미 사용 중인 아이디입니다."; 22 │ │ } 23 │ │ 24 │ │ let shouldRedirect = false; 25 │ │ try { 26 │ │ const response = await fetch( 27 │ │ `${process.env.NEXT_PUBLIC_BASE_URL}/api/users`, 28 │ │ { 29 │ │ method: "post", 30 │ │ body: formData, 31 │ │ credentials: "include", 32 │ │ } 33 │ │ ); 34 │ │ console.log(response.status); 35 │ │ if (response.status === 403) { 36 │ │ return { message: "user_exists" }; 37 │ │ } 38 │ │ console.log(await response.json()); 39 │ │ shouldRedirect = true; 40 │ │ } catch (err) { 41 │ │ console.error(err); 42 │ │ } 43 │ │ if (shouldRedirect) { 44 │ │ redirect("/home"); 45 │ │ } 46 │ ╰─▶ }; 47 │ return ( 48 │ <> 49 │ <div className={style.modalBackground}> ╰──── 서버 액션부분을 다른 컴포넌트로 분리해서 사용해야 하는거 같은데 강의 내용에서는 바로 진행이 되서 제가 어느부분이 잘못되었는지 잘 모르겠습니다. 그리고 혹시 최상단에 "use client"를 작성하지 않았기에 이건 서버컴포넌트인줄 알았는데 에러메세지에 클라이언트 컴포넌트에서 사용할 수 없다는건 현재 컴포넌트가 클라이언트 컴포넌트인건가요...? 아래는 제가 작성한 코드입니다. import style from "./signup.module.css"; import BackButton from "./BackButton"; import { redirect } from "next/navigation"; export default function SignupModal() { const submit = async (formData: FormData) => { "use server"; if (!formData.get("id")) { return "아이디를 입력하세요."; } if (!formData.get("name")) { return "닉네임을 입력하세요."; } if (!formData.get("password")) { return "비밀번호를 입력하세요."; } if (!formData.get("image")) { return "이미지를 업로드하세요."; } if (!formData.get("id")) { return "이미 사용 중인 아이디입니다."; } let shouldRedirect = false; try { const response = await fetch( `${process.env.NEXT_PUBLIC_BASE_URL}/api/users`, { method: "post", body: formData, credentials: "include", } ); console.log(response.status); if (response.status === 403) { return { message: "user_exists" }; } console.log(await response.json()); shouldRedirect = true; } catch (err) { console.error(err); } if (shouldRedirect) { redirect("/home"); } }; return ( <> <div className={style.modalBackground}> <div className={style.modal}> <div className={style.modalHeader}> <BackButton /> <div>계정을 생성하세요.</div> </div> <form action={submit}> <div className={style.modalBody}> <div className={style.inputDiv}> <label className={style.inputLabel} htmlFor="id"> 아이디 </label> <input id="id" name="id" className={style.input} type="text" placeholder="" required /> </div> <div className={style.inputDiv}> <label className={style.inputLabel} htmlFor="name"> 닉네임 </label> <input id="name" name="name" className={style.input} type="text" placeholder="" required /> </div> <div className={style.inputDiv}> <label className={style.inputLabel} htmlFor="password"> 비밀번호 </label> <input id="password" name="password" className={style.input} type="password" placeholder="" required /> </div> <div className={style.inputDiv}> <label className={style.inputLabel} htmlFor="image"> 프로필 </label> <input id="image" name="image" className={style.input} type="file" accept="image/*" required /> </div> </div> <div className={style.modalFooter}> <button type="submit" className={style.actionButton}> 가입하기 </button> </div> </form> </div> </div> </> ); }

  • react
  • next.js
  • react-query
  • next-auth
  • msw
박 태영 댓글 2 좋아요 0 조회수 881

next의 확장된 fetch 캐싱에 대해 질문드립니다.

미해결

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

fetch 함수를 사용할 때 next 객체 tags에 태그들을 지정해서 넣는 것으로 배웠습니다. 제가 이해하기로는 그 태그들로 분류되어 next가 캐싱하는 걸로 알고 있는데, 브라우저 쪽에서 작동하는 fetch(예를 들어 onclick에 붙어있는 fetch라든지... )와 next 서버 쪽에서 작동하는 fetch(예를 들어 api 디렉토리의 routes.ts에서 동작하는...)의 태그가 같다면 캐시 공유가 되나요? 브라우저는 브라우저 쪽에 서버 쪽 fetch는 서버 쪽에 저장될 것 같은데 어떻게 동작하는지 질문드립니다.

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

useQuery vs useQueryClient

해결됨

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

tanstack query와 next.js 를 함께 사용하면서 의문이 들어 질문합니다! 강의의 코드를 보니 같이 prefetch를 해도 유저데이터는 useQueryClient를 사용해서 데이터를 재사용하는듯한데 안에 하위 컴포넌트의 경우 prefetch를하고 useQuery를 사용해서 데이터를 가져오는듯 하더라구요 이 경우도 데이터를 재사용하는건가요? 아니면 새로 가져오는건가요? 그렇다면 똑같이 데이터를 prefetch해도 useQueryClient를 사용해서 가져오는것과 useQuery를 사용해서 가져와야하는 기준이 있을까요? (저의경우 프로젝트 전체를 prefetch후 useQueryClient를해서 데이터를 가져왔더니 데이터를 가져옴과 동시에 fresh가아니라 inactive상태가 되더라구요. ) 좋은강의 감사합니다. 벚꽃같은 제로초 화이팅

  • react
  • next.js
  • react-query
  • next-auth
  • msw
개발새발 댓글 1 좋아요 0 조회수 609

첫 로그인 후 req.user.id 사용이 어텋게 가능한지 궁금합니다.

미해결

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

..// user.js router.post("/login", isNotLoggedIn, (req, res, next) => { passport.authenticate("local", (err, user, info) => { // ... return req.login(user, async (loginErr) => { if (loginErr) { console.error(loginErr); return next(loginErr); } const fullUserWithoutPassword = await User.findOne({ where: { id: req.user.id }, // ... }); return res.status(200).json(fullUserWithoutPassword); }); })(req, res, next); }); // index.js const passport = require("passport"); const local = require("./local"); const { User } = require("../models"); module.exports = () => { passport.serializeUser((user, done) => { done(null, user.id); }); passport.deserializeUser(async (id, done) => { console.log(`deserializeUser`) try { const user = await User.findOne({ where: { id } }); done(null, user); // req.user안에 넣어줌 } catch (error) { console.error(error); done(error); } }); local(); }; 첫 로그인 할 때는 serializeUser만 실행되고, 그 이후 요청 부터 deserialzeUser가 실행되어 req.user에 db 테이블에 user객체가 저장되는 걸로 이해했습니다. 첫 로그인 할 때는 deserializeUser가 실행이 안되어서 req.user가 저장이 안된 상태일텐데 어텋게 req.user.id 로 fullUserWithoutPassword 에 값을 할당할 수 있는지 궁금합니다.

  • react
  • redux
  • node.js
  • express
  • next.js
쾌할한 전복 댓글 1 좋아요 0 조회수 281

[도메인 연결하기] 로그인 완료 후에 getServerSideProps 실행되지만,회원정보가 null 이 표시 되는 이유를 몰라서 질문드립니다.

미해결

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

React로 Nodebird sns를 시청하고 나서 개인 프로젝트를 만들고 나서 배포하는 과정에서 막히는 부분이 있어서 질문드립니다. 기존에 localhost:3060 에서 로그인 완료후 메인화면으로 이동시 메인화면 서버사이드 렌더링이 실행됩니다. export const getServerSideProps = wrapper.getServerSideProps(async (context) => { const cookie = context.req ? context.req.headers.cookie : ''; axios.defaults.headers.Cookie = ''; if (context.req && cookie) { axios.defaults.headers.Cookie = cookie; } context.store.dispatch({ type: LOAD_MY_INFO_REQUEST, }) context.store.dispatch(END); await context.store.sagaTask.toPromise(); }) 그래서, const dispatch = useDispatch(); const { me } = useSelector((state) => state.user); me에 데이터가 들어있습니다. [ 도메인 연결하기] 영상 시청후 Route 53, 가비아 주소, 탄력적 ip 주소를 사용하여 백엔드/ 프론트 서버를 실행하였습니다. 회원가입 후 로그인하고 나서 메인 화면으로 이동되면 쿠키가 저장되는 것을 확인했습니다 하지만 로그인 후 메인 화면으로 이동하면, 메인page에 서버사이드 렌더링 코드(getServerSideProps)가 실행하고, export const getServerSideProps = wrapper.getServerSideProps( async (context) => { const cookie = context.req ? context.req.headers.cookie : ""; axios.defaults.headers.Cookie = ""; if (context.req && cookie) { axios.defaults.headers.Cookie = cookie; } context.store.dispatch({ type: LOAD_MY_INFO_REQUEST, }); context.store.dispatch(END); await context.store.sagaTask.toPromise(); } ); const dispatch = useDispatch(); const { me } = useSelector((state) => state.user); 이때 로그인한 사용자의 데이터 정보가 null로 표시됩니다. [back logs] 왜 me가 null 인지 ? 무엇이 문제인지 모르겠어서 질문드립니다. 진행 순서 [로그인 화면] : 아이디와 비밀번호 를 입력하고 확인 버튼을 누른다. 메인화면에서 서버사이드 렌더링 코드부분 실행하여 회원정보를 불러온다. (LOAD_MY_INFO_REQUEST) export const getServerSideProps = wrapper.getServerSideProps(async (context) => { const cookie = context.req ? context.req.headers.cookie : ''; axios.defaults.headers.Cookie = ''; if (context.req && cookie) { axios.defaults.headers.Cookie = cookie; } context.store.dispatch({ type: LOAD_MY_INFO_REQUEST, }) context.store.dispatch(END); await context.store.sagaTask.toPromise(); }) export default Blog; const dispatch = useDispatch(); const { me } = useSelector((state) => state.user); 3. [메인화면] 회원정보를 불러와 회원정보가 null 이여서 로그아웃 버튼으로 변경되지 않습니다. (me 정보가 null 여서 버튼이 변경되지 않습니다.) 쿠기는 유지되어서 로그인 화면으로 가서 로그인 할시 "로그인하지 않은 사용자만 접근 가능합니다" 안내창이 나옵니다.

  • react
  • redux
  • node.js
  • express
  • next.js
박동규 댓글 2 좋아요 0 조회수 241

[username] 경로와 home 경로로 라우팅할 때 오류

미해결

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

"홈탭 만들면서 Context API" 강좌를 듣고 localhost3000/home에 들어가면 localhost3000/[username] 경로로 들어가지다가(화면에 '프로필 페이지'라고 뜨는 것을 보니 이런 것 같습니다! ) 화면이 빈 화면으로 바뀝니다.. 그리고 왼쪽 섹션에 있는 프로필을 클릭하면 아래와 같은 오류가 뜹니다 ㅠ 무슨 문제일까요? 오류 내용 : ⨯ Error: Cannot find module '/Users/ryuhojun/Documents/z-com/.next/server/app/(afterLogin)/[username]/page.js' Require stack: - /Users/ryuhojun/Documents/z-com/node_modules/next/dist/server/require.js - /Users/ryuhojun/Documents/z-com/node_modules/next/dist/server/load-components.js - /Users/ryuhojun/Documents/z-com/node_modules/next/dist/build/utils.js - /Users/ryuhojun/Documents/z-com/node_modules/next/dist/server/dev/hot-middleware.js - /Users/ryuhojun/Documents/z-com/node_modules/next/dist/server/dev/hot-reloader-webpack.js - /Users/ryuhojun/Documents/z-com/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js - /Users/ryuhojun/Documents/z-com/node_modules/next/dist/server/lib/router-server.js - /Users/ryuhojun/Documents/z-com/node_modules/next/dist/server/lib/start-server.js

  • react
  • next.js
  • react-query
  • next-auth
  • msw
유호준 댓글 2 좋아요 0 조회수 271

제목과 영상이 다른것 같아요~

해결됨

Airflow 마스터 클래스

Task 실패시 email 발송하기 sla 로 task 수행현황 감시하고 email 발송하기 이 두개의 영상이 바뀐것 같아 보입니다 확인 해봐주세요~

  • python
  • 데이터-엔지니어링
  • airflow
qkswl6253 댓글 1 좋아요 0 조회수 263

localstorage.setItem 위치 질문

해결됨

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

수업에서는 '카운트다운 시작' 버튼 눌러서 Starter 함수가 실행되면 로컬 스토리지가 setInterval 함수로 인해 비워지기 때문에, CounterMaker 함수 내에 if문을 작성하여 해결하고 있습니다. 저는 이 방법 말고 사진처럼 starter 함수 내부에서 setInterval 함수(clearTimer라고 작성한..) 호출 위치를 조정하여 해결하였는데, 이 방법에 문제가 있을지 궁금합니다!

  • react
  • node.js
  • seo
  • graphql
  • next.js
연민지 댓글 2 좋아요 0 조회수 257

404 오류 관련 질문

해결됨

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

05-05-dynamic-routing-board-mutation 05-05-dynamic-routing-board-mutation-moved 계속해서 대조해보지만 게시글 등록하기를 누르고 moved 페이지로 넘어갈 때 404 오류가 뜹니다. catch에서 잡히지 않는걸로 보아 데이터 전송에서 문제가 있는건 아니지 않을까 싶은데, 아무리 봐도 해결책이 보이지 않아 질문 남깁니다.

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

\ <-이 작대기 작성 키는 무엇인가요??

미해결

프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)

\ <-이 작대기 작성 키는 무엇인가요??

  • python
재원정 댓글 2 좋아요 0 조회수 291

인기 태그

인프런 TOP Writers

주간 인기글