본문 바로가기
웹/React

[React/에러] TypeError: Cannot read properties of null (reading 'title')

by ohojee 2023. 9. 1.

이 검색창을 만들고 싶어서 searchbox를 input으로 만들고 그 안에 아이콘을 넣었다. 

<SearchBox>
    <IoSearch size="40"/>
</SearchBox>
input is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.

그랬더니 이런 오류가 떴다. input태그 안에는 children이 없어야 한다는 의미이다.

그래서 전체를 div로 감싸고 input과 아이콘을 넣어주었다.

댓글