안녕하세요 강사님 앱을 종료했다가 접속하면 정상적으로 보입니다. 그런데 이미지, 닉네임을 설정하고 뒤로가기하면 아래와 같이 오류가 발생합니다.. 😭 그런데 또 왔다갔다 하다보면 다시 또 프로필이 보입니다.. 🥲 https://github.com/KMSKang/react.git
안녕하세요, app router에 대해 계속 공부하다가 route handlers 에 대한 궁금증이 해결되지 않아 질문하게 됐습니다. Next app router에서 정확히 route handlers를 사용해야 하는 이유가 무엇인가요? 제가 생각했을 땐 서버 데이터 캐싱이나 API 엔드포인트를 숨길 수 있다는 장점이 있는데 이건 서버 컴포넌트에서 fetch하는 것으로도 대체가 되는데 route handlers를 사용해야 하는 특별한 이유가 따로 있는 것인가요? 모든 API를 route handlers로 하면 Next서버에 부하가 걸릴텐데 어떻게 해결할 수 있을까요? 이 부분은 공식문서에서 제가 못 찾은 것 같은데, 만약 외부 백엔드 API가 있고 여기에 데이터 요청을 할 때 클라이언트 컴포넌트에서의 모든 API 요청을 1차로 route handler에 하고 여기서 외부 백엔드 API로 요청하게되면 route handlers에 요청이 몰리게 되는데 이때 Next 서버에 걸리는 부하를 어떻게 해소할 수 있을까요?
제로초님 하신대로 그대로 프로젝트를 생성하고 실행했더니 화면은 그대로 뜨는데 에러가 1개 있어서 봤더니 hydration 에러라고 뜨네요 ㅠㅠ 지금 z-com 프로젝트를 수업용 / 연습용으로 총 2개 진행중인데 수업용 프로젝트는 이런 에러가 없었는데 연습용에서 에러가 발생하네요. 아래는 에러 코드입니다 ! Console Error Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used - A server/client branch if (typeof window !== 'undefined') . - Variable input such as Date.now() or Math.random() which changes each time it's called. - Date formatting in a user's locale which doesn't match the server. - External changing data without sending a snapshot of it along with the HTML. - Invalid HTML tag nesting. It can also happen if the client has a browser extension installed which messes with the HTML before React loaded
안녕하세요 nextjs를 활용해서 프로젝트를 진행하는 중에 해결되지 않는 문제가 발생하여 질문 드립니다. 현재 도커를 활용해서 nextjs를 배포하고 있는데 middleware에서 request.nextUrl.origin값이 https://localhost:3000이 들어가고 있습니다. x-forwarded-host를 찍었을때는 제가 사용하는 https://test.domain.com이 들어가는데 request.nextUrl.origin에 x-forwared-host와 같은 값이 들어가도록 설정하기 위한 방법이 있는지 알 수 있을까요??
문제가 발생한 코드 로직에 대해 설명드리자면 유저가 어떤 상태 선택창을 띄우고 상태를 변경하면 서버로 요청을 보내고 응답이 와서 변경된 데이터로 새로 렌더링 되는 로직입니다. 그런데 여기서 저는 상태 선택창을 닫히지 않게 하고 싶습니다. 그런데 useState를 사용하면 리렌더링 됐을 때 당연히 상태가 초기화 돼서 선택창이 사라질 것이기 때문에 useRef를 사용했습니다. 아래가 그 코드인데 useRef로 했음에도 리렌더링 되고 초기 상태인 false로 바뀌어버립니다. 그래서 상태창을 유지하지 못하고 있습니다. 해결법 좀 아시는 고수님들 도움 좀 주셨으면 좋겠습니다 ㅠ const maintainStatus = useRef(false); const changeStatus = (status: LocationStatusType) => { mutate({ locationStatus: status }, { onSuccess: async (res) => { // 성공시 await queryClient.invalidateQueries({ queryKey: homelessListQueryKey }); // 쿼리 최신화 maintainStatus.current = true; console.log("maintainStatus.current:", maintainStatus.current) //true 출력 } }) } useEffect(() => { console.log("Updated maintainStatus.current:", maintainStatus.current); // false 출력 }, [maintainStatus.current]);
# Material Tailwind 와 연관된 라이브러리 설치 npm install @emotion/react @emotion/styled @material-tailwind/react @mui/icons-material --save npm install @tailwindcss/typography autoprefixer --save-dev 지난주 공개된 next.js 15에서 Material Tailwind 설정하려니 안되서 도움 부탁드립니다. 아직 초보라 이런 부분들이 개인적으로 좀 어렵네요~~^^;
❗ 질문 작성시 꼭 참고해주세요 최대한 상세히 현재 문제(또는 에러)와 코드(또는 github) 를 첨부해주셔야 그만큼 자세히 답변드릴 수 있습니다. 맥/윈도우, 안드로이드/iOS, ReactNative, Node 버전 등의 개발환경 도 함께 적어주시면 도움이 됩니다. 에러메세지는 일부분이 아닌 전체 상황 을 올려주세요. ( 일부만 자르거나 일부만 복사해서 올려주시면 답변이 어렵습니다. ) m1 맥 ios Node : 20.10.0 ruby : 3.1.0 - 2.7.6 버전으로 다운받고 실행했을때 cocoapods가 현재는 2.7.6버전이 아닌 3.1.0버전 이상이 필요하다하여 사용했습니다. cd ios rm -rf Pods rm -rf Podfile.lock pod install 위 명령어를 사용해서 pod도 재설치 한 뒤 xcode로 실행해도 빌드가 되지 않습니다. xcode에서는 아래와같은 오류가 나옵니다. Command PhaseScriptExecution failed with a nonzero exit code vscode에서는 아래와 같이 나옵니다. info Opening the app on iOS... info Found Xcode workspace "MatzipApp_01.xcworkspace" info No booted devices or simulators found. Launching first available simulator... info Launching iPhone SE (3rd generation) (iOS 18.0) info Building (using "xcodebuild -workspace MatzipApp_01.xcworkspace -configuration Debug -scheme MatzipApp_01 -destination id=675A0CA6-486F-4EF1-A232-AAC4D04C438D") info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MatzipApp_01.xcworkspace -configuration Debug -scheme MatzipApp_01 -destination id=675A0CA6-486F-4EF1-A232-AAC4D04C438D User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES Prepare packages ComputeTargetDependencyGraph note: Building targets in dependency order note: Target dependency graph (56 targets) Target 'MatzipApp_01' in project 'MatzipApp_01' ➜ Implicit dependency on target 'Pods-MatzipApp_01' in project 'Pods' via file 'libPods-MatzipApp_01.a' in build phase 'Link Binary' ➜ Implicit dependency on target 'CocoaAsyncSocket' in project 'Pods' via options '-lCocoaAsyncSocket' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'DoubleConversion' in project 'Pods' via options '-lDoubleConversion' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'Flipper' in project 'Pods' via options '-lFlipper' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'Flipper-Boost-iOSX' in project 'Pods' via options '-lFlipper-Boost-iOSX' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'Flipper-Fmt' in project 'Pods' via options '-lFlipper-Fmt' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'Flipper-Folly' in project 'Pods' via options '-lFlipper-Folly' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'Flipper-PeerTalk' in project 'Pods' via options '-lFlipper-PeerTalk' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'FlipperKit' in project 'Pods' via options '-lFlipperKit' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'RCT-Folly' in project 'Pods' via options '-lRCT-Folly' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'RCTTypeSafety' in project 'Pods' via options '-lRCTTypeSafety' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-Codegen' in project 'Pods' via options '-lReact-Codegen' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-Core' in project 'Pods' via options '-lReact-Core' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-CoreModules' in project 'Pods' via options '-lReact-CoreModules' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-NativeModulesApple' in project 'Pods' via options '-lReact-NativeModulesApple' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTAnimation' in project 'Pods' via options '-lReact-RCTAnimation' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTAppDelegate' in project 'Pods' via options '-lReact-RCTAppDelegate' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTBlob' in project 'Pods' via options '-lReact-RCTBlob' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTImage' in project 'Pods' via options '-lReact-RCTImage' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTLinking' in project 'Pods' via options '-lReact-RCTLinking' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTNetwork' in project 'Pods' via options '-lReact-RCTNetwork' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTSettings' in project 'Pods' via options '-lReact-RCTSettings' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTText' in project 'Pods' via options '-lReact-RCTText' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-RCTVibration' in project 'Pods' via options '-lReact-RCTVibration' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-cxxreact' in project 'Pods' via options '-lReact-cxxreact' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-debug' in project 'Pods' via options '-lReact-debug' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-hermes' in project 'Pods' via options '-lReact-hermes' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-jsi' in project 'Pods' via options '-lReact-jsi' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-jsiexecutor' in project 'Pods' via options '-lReact-jsiexecutor' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-jsinspector' in project 'Pods' via options '-lReact-jsinspector' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-logger' in project 'Pods' via options '-lReact-logger' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-perflogger' in project 'Pods' via options '-lReact-perflogger' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-runtimescheduler' in project 'Pods' via options '-lReact-runtimescheduler' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'React-utils' in project 'Pods' via options '-lReact-utils' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'ReactCommon' in project 'Pods' via options '-lReactCommon' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'SocketRocket' in project 'Pods' via options '-lSocketRocket' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'Yoga' in project 'Pods' via options '-lYoga' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'YogaKit' in project 'Pods' via options '-lYogaKit' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'fmt' in project 'Pods' via options '-lfmt' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'glog' in project 'Pods' via options '-lglog' in build setting 'OTHER_LDFLAGS' ➜ Implicit dependency on target 'libevent' in project 'Pods' via options '-llibevent' in build setting 'OTHER_LDFLAGS' Target 'Pods-MatzipApp_01' in project 'Pods' ➜ Explicit dependency on target 'CocoaAsyncSocket' in project 'Pods' ➜ Explicit dependency on target 'DoubleConversion' in project 'Pods' ➜ Explicit dependency on target 'FBLazyVector' in project 'Pods' ➜ Explicit dependency on target 'FBReactNativeSpec' in project 'Pods' ➜ Explicit dependency on target 'Flipper' in project 'Pods' ➜ Explicit dependency on target 'Flipper-Boost-iOSX' in project 'Pods' ➜ Explicit dependency on target 'Flipper-DoubleConversion' in project 'Pods' ➜ Explicit dependency on target 'Flipper-Fmt' in project 'Pods' ➜ Explicit dependency on target 'Flipper-Folly' in project 'Pods' ➜ Explicit dependency on target 'Flipper-Glog' in project 'Pods' ➜ Explicit dependency on target 'Flipper-PeerTalk' in project 'Pods' ➜ Explicit dependency on target 'FlipperKit' in project 'Pods' ➜ Explicit dependency on target 'OpenSSL-Universal' in project 'Pods' ➜ Explicit dependency on target 'RCT-Folly' in project 'Pods' ➜ Explicit dependency on target 'RCTRequired' in project 'Pods' ➜ Explicit dependency on target 'RCTTypeSafety' in project 'Pods' ➜ Explicit dependency on target 'React' in project 'Pods' ➜ Explicit dependency on target 'React-Codegen' in project 'Pods' ➜ Explicit dependency on target 'React-Core' in project 'Pods' ➜ Explicit dependency on target 'React-CoreModules' in project 'Pods' ➜ Explicit dependency on target 'React-NativeModulesApple' in project 'Pods' ➜ Explicit dependency on target 'React-RCTActionSheet' in project 'Pods' ➜ Explicit dependency on target 'React-RCTAnimation' in project 'Pods' ➜ Explicit dependency on target 'React-RCTAppDelegate' in project 'Pods' ➜ Explicit dependency on target 'React-RCTBlob' in project 'Pods'
❗ 질문 작성시 꼭 참고해주세요 최대한 상세히 현재 문제(또는 에러)와 코드(또는 github) 를 첨부해주셔야 그만큼 자세히 답변드릴 수 있습니다. 맥/윈도우, 안드로이드/iOS, ReactNative, Node 버전 등의 개발환경 도 함께 적어주시면 도움이 됩니다. 에러메세지는 일부분이 아닌 전체 상황 을 올려주세요. ( 일부만 자르거나 일부만 복사해서 올려주시면 답변이 어렵습니다. ) 안녕하세요! 강의 너무 잘 듣고 있습니다. 만들면서 따라가다 보니 에러가 나거나 하지는 않았지만 궁금한 점이 생겨서 질문남깁니다. 이번 강의에서 ScoreInput 컴포넌트에 전달하는 onChangeScore 함수로 handleChangeScore 를 정의해서 넘기셨는데, 사실 이 함수가 하는 일은 현재 setScore를 하는 것 뿐이라 그냥 setScore 함수를 넘겨도 되지 않는지 의문이 들어서요. 혹여 그렇게 했을 경우 문제가 되거나 하는 부분이 있다면 말씀 부탁드립니다. 감사합니다!