I have a object and inside of object hava data array. But i cant access it. When i log my object i can see my data inside like that : https://ibb.co/mJfHnhq
But when i try write like objectname.data its show empty array like : https://ibb.co/yNSDb94 How can i call it for access my data. I need send it to component but when i send objectname.data its sending empty array. Thanks for reply!
Its How i fill my object data :
const [myData,setMyData]=useState(DropdownElements); //Dropdown elements holds my url title empty array data for fill etc.
const [myDatax,setMyDatax]=useState([]);
useEffect(() => {
myData.map((x, i) => {
fetch(x.apiUrl)
.then((z) => z.json())
.then((result) => {
myData[i].data = result;
setMyData(myData);
});
});
}, []);
Its where i try use it but when i write x.data i cant see my data
return (
<div>
{myData.map(x=>{
console.log('MYDATA',x.data)
return (
<MySpecialPicker
key={x.key}
placeholder={x.placeholder}
onChange={change=>onchange(change)}
datasource={x.data}
>
</MySpecialPicker>
)
})}
</div>
)
}