본문 바로가기
PROGRAMING📚/React📑

[React:Error] Cannot read properties of null (reading 'useRef')

별찌루 2024. 1. 19.
728x90
반응형

Cannot read properties of null (reading 'useRef')

 

react-query를 설치하면서 index.js 를 수정하다가 문제가 생긴거같은데

인터넷에 검색을 해보니 뭐.. 경로가 맞지 않거나 버전이 호환되지 않아서 그런 문제라는 말이 많아서 

혹시 몰라서 일단 react를 update를 해주었다

 

npm update를 했더니

뭔가 관련된 문제가 나온거 같긴한데 아직도 정확하게 뭔지는 모르겠다

 

Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, open 'D:\Github\React\shopping-mall\node_modules\@reduxjs\toolkit\node_modules\immer\dist\immer.mjs'

 

모듈 빌드 실패(./node_modules/source-map-loader/dist/cjs.js에서):
오류: ENOENT: 해당 파일 또는 디렉토리가 없습니다. 'D:\Ghubit\React\shopping-mall\node_modules\@reduxjs\toolkit\node_modules\immer\dist\immer.mjs'를 엽니다

 

 

 

node-moudules 패키지 다시 다운해도 안됨.. 진짜.. ㅜㅜㅜ

이것 저것 설치해도 안되서.. 결국 index.js 안에 넣었던 코드 주석 처리 해둠..

let result2 =  useQuery('useReactQuery',()=>{
 const a = await axios.get('https://codingapple1.github.io/userdata.json');
  return a.data;
})

 

여기서 오류가 나는 것으로 확인됨..

react-query 버전이 바뀌면서 코드 오류인거같음..

728x90
반응형

댓글