typescript
21.12.12 'Element[]' 형식에 'ReactElement<any, any>' 형식의 type, props, key 속성이 없습니다.
슈팅스타제제
2021. 12. 12. 20:45
원래는 AppContainer 하위에 map으로 돌린 컴포넌트밖에 없었는데
AppContainer 안에 map 돌린 컴포넌트 바로 위에 컴포넌트를 하나 더 추가했더니 다음과 같은 오류가 발생하였다.
Type 'Element[]' is missing the following properties from type 'Element': type, props, key
I have the standard arrow map ES7 function with Typescript and React environment: const getItemList: Function = (groups: any[]): JSX.Element => group.map((item: any, i: number) => { ...
stackoverflow.com
방법 1: forEach 써보기
방법 2: key, value에 대한 타입 정의해주기
방법 3: ReactFC로 변수 설정해서 return 해주기