본문 바로가기
IT/react

React - Ref 에러 잡기

by 내일은교양왕 2023. 6. 18.

에러 문구

client.js:1 Warning: React does not recognize the videoRef prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase videoref instead. If you accidentally passed it from a parent component, remove it from the DOM element.

 

원인

useRef의 변수를 자식 컴포넌트의 prop으로 넘길 때 videoRef라는 속성으로 넘겨서 생긴 이슈

 

 

해결 방법

해당 자식 컴포넌트를 fowardRef로 감싸고, ref속성으로 videoRef 변수를 받으면 해결

 

 

 

 

'IT > react' 카테고리의 다른 글

React - Virtual Dom  (0) 2023.06.22
React - List Key의 중요성  (0) 2023.06.22
React - batching  (0) 2023.06.22
React component, preload 로 최적화 하기  (0) 2023.05.27
Code splitting using 'Loadable'  (0) 2023.05.27