I want to console my function and I hope I can make this function to go not in only 1 file
let's say my code is like this
const insertMember = async (v) => {
const member = [];
await Promise.all(v.map(async (evalue) => {
const result = await HttpHelper.get(`${api.usersUrl}?filter-email=${evalue.email}`);
const value = result?.data?.data[0]?.avatar?.url?.small;
const obj = {
nik: evalue?.nik,
name: evalue?.name,
position: evalue?.position,
external: evalue?.isExternal,
email: evalue.email,
avatar: value,
};
member.push(obj);
}));
setInternal(member);
return member;
};
and when I check with my useEffect
useEffect(() => {
insertMember(description?.partnerSelection?.recipients)
.then((data) => console.log('MY DATA', data));
}, []);
it only shows MY DATA []
What should I do to make the console show the result? The setter working successfully, but in this case I want to see what make the console empty array