Reputation: 237
i have some array looks like this:
const [listArr, setLA]= useState([
{
id: Math.floor(Math.random * 100000),
data: "This is data 1",
},
{
id: Math.floor(Math.random * 100000),
data: "This is data 2",
},
....(and so on)
]);
and i need to extract those data
to become 1 variable
and get it using console looks like
console.log(data);
//This is data 1\nThis is data2
I've tried using foreach to put 1 by 1 but still didn't work, can you guys help me?
Upvotes: 0
Views: 43