1. 코드 이렇게 짰는데 cannot read 오류 발생합니다. 데이터는 잘 받아오는데... 이유를 모르겠습니다.
(Cannot read properties of undefined (reading 'name'))
let result = useQuery(['작명'],() => {
axios.get('https://codingapple1.github.io/userdata.json')
.then((data) => {return data.data;})
.catch((error) => console.log(error))
},{staleTime : 2000});
//... 생략
<Nav.Link >{result.isLoading ? '로딩중' : result.data.name}</Nav.Link>
여기서 name값을 못 읽는다고 하네요. 왜그런지 모르겠습니다.
2. useQuery에 ['작명'] 부분은 어디에 쓰는 놈인지 궁금합니다.
-
이 게시글은
Big battery에 의해 8 월, 2 주 전에 수정됐습니다. 이유: console.log 사진 추가