React DOM 요소에 prop 전달 경고
1. 에러 메시지
Warning: React does not recognize the
isCheckedprop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercaseischeckedinstead. If you accidentally passed it from a parent component, remove it from the DOM element.
React가 DOM 요소에 붙은 isChecked prop을 알아보지 못한다는 경고다.
DOM에 사용자 정의 속성으로 남기려는 거라면 소문자 ischecked로 쓰고, 부모 컴포넌트에서 실수로 넘긴 거라면 DOM 요소에서 지우라고 한다.
2. 원인
기능은 잘 동작하지만, 컴포넌트용 prop을 div·input 같은 DOM 요소에 그대로 넘겨서 생기는 경고다.
prop은 컴포넌트에 넘겨야지, DOM 요소에 넘기면 안 된다.
3. 해결
DOM 요소에 prop을 넘긴 부분을 찾아서 지운다.