React Uncaught Error

HMJ·2024년 12월 17일
Uncaught Error: input is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`

발단

input tag로 radio를 만들고 있는 중이다.

해결

  • 오류가 난 코드...
<input type="radio" ... > item1 </input>
  • 오류 해결
<input type="radio" ... />
<label> item1 </label>

input은 하위 콘텐츠를 가질 수 없는 빈 요소이다. 그러므로 </input>이 필요가 없다는 뜻!
그래서 예러가 뜬 것이다.
참조_codingEverybody{}

0개의 댓글