Internal error: Error: Objects are not valid as a React child (found: object with keys {...}). If you meant to render a collection of children, use an array instead.

j_wisdom_h·2023년 11월 30일
0

Error

목록 보기
5/8

Internal error: Error: Objects are not valid as a React child (found: object with keys {...}). If you meant to render a collection of children, use an array instead.

object타입을 지켜주면 해결된다.

// getData =
[
  {
    id: 'person',        
    username: 'pp',      
    password: 'personal',
    email: 'dd',
    address: 'dd',
    age: 20
  }
]
[
  {
    id: 'person',
    username: 'pp',
    password: 'personal',
    email: 'dd',
    address: 'dd',
    age: 20
  }
]


 return  <> {getdata} <>  // 이러면 에러 발생!
 return ( // 이렇게 써보자
   <div>
     {getdata.map((data, i) => {
       return (
         <>
           <p>
             {data.id} {data.username}
           </p>
           </>
       )
     })}
   </div>
 )
profile
뚜잇뚜잇 FE개발자

0개의 댓글