const selectFile = async () => {
const options = {
mediaType: "photo",
quality: 1,
};
const result = await ImagePicker.launchImageLibraryAsync(options);
const imageData = JSON.parse(JSON.stringify(result.uri));
imageData.map (async (val) => {
setImageSourcePath(val.uri);
const file = new Moralis.File(val.fileName, val);
const saveIpfsData = await file.saveIPFS();
setAvatar(saveIpfsData.url());
});
};
.map
need to return a value and it is not idea for what you are trying to do, you may want to use
.map
when trying to render some thing to the browser and you want to loop
okay thank youโฆ please can you help me out
try using a loop, but what you are doing doesnโt exactly looks like it need a loop
you want to save a new file to ipfs and then set the image, you can do this in a function, must not use a loop or .map