4 글 보임 - 1 에서 4 까지 (총 4 중에서)
-
글쓴이글
-
2025년 12월 4일 13:14 #143921

정법진참가자안녕하세요. 현재 쇼핑몰 프로젝트 24번째 강의까지 들었는데요. 선생님이 말씀하신대로 App.jsx 파일에 아래의 소스를 작성했더니 스크립트 오류가 발생하네요. ======================================== App.jsx ---------------------------------------------------------- import { useQuery } from '@tanstack/react-query'; function App() { let result = useQuery({ queryKey: ['getName'], queryFn: (a)=>{ axios.get('https://codingapple1,github.io/userdata.json') .then(a => a.data) } }); } ======================================== @@@@@@@@@@@@@@@@@@@@@@@ 에러 내용 @@@@@@@@@@@@@@@@@@@@@ App.jsx:25 GET https://codingapple1,github.io/userdata.json net::ERR_NAME_NOT_RESOLVED @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 그리고 Detail.jsx 파일에 아래의 소스를 작성했더니 스크립트 오류가 발생하네요. =================================== Detail.jsx ----------------------------------------------- import { useQueryClient } from '@tanstack/react-query';// 상세페이지 디자인 function Detail(props){ let q = useQueryClient(); let result = q.getQueryData(['getName']); console.log(result); } =================================== @@@@@@@@@@@@@@@@@@@@@@@ 에러 내용 @@@@@@@@@@@@@@@@@@@@@ axios.js?v=f86eba02:1945 Uncaught (in promise) AxiosError$1 {message: 'Network Error', name: 'AxiosError', code: 'ERR_NETWORK', config: {…}, request: XMLHttpRequest, …} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 그리고 main.jsx 파일에 아래의 소스를 작성했더니 스크립트 오류가 발생하네요. =========================================================== main.jsx ------------------------------------------------------------------------------ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";const queryClient = new QueryClient();
const root = ReactDOM.createRoot(document.getElementById('root')); root.render( <React.StrictMode> <QueryClientProvider client={queryClient}> <Provider store={store}> <BrowserRouter> <App /> </BrowserRouter> </Provider> </QueryClientProvider> </React.StrictMode> ); =========================================================== @@@@@@@@@@@@@@@@@@@@@@@ 에러 내용 @@@@@@@@@@@@@@@@@@@@@ main.jsx:19 Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ["getName"] @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2025년 12월 9일 01:48 #143988
정법진참가자네. 말씀하신대로 오타를 수정했더니 다른 오류들은 없어졌는데 아래의 오류는 여전히 남아있습니다. @@@@@@@@@@@@@@@@@@@@@@@ 에러 내용 @@@@@@@@@@@@@@@@@@@@@ main.jsx:19 Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ["getName"] @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ['getName'] 설정에 문제가 있을까요? 제가 보기엔 문제가 없는 듯 한데...
2025년 12월 9일 09:24 #143991
codingapple키 마스터queryFn: (a)=>{ axios.get('https://codingapple1,github.io/userdata.json') .then(a => a.data) }에서 중괄호를 없애봅시다
-
글쓴이글
4 글 보임 - 1 에서 4 까지 (총 4 중에서)
- 답변은 로그인 후 가능합니다.
