Below are snippets of my code. Im mapping my data to rename item.image.url but I am getting and undefined value on my image.
export function flattenProducts(data) {
return data.map((item) => {
let image = item.image.url
return { ...item, image };
});
}
React.useEffect(() => {
axios.get(`${url}/products`).then((response) => {
const products = flattenProducts(response.data);
console.log(products);
});
}, []);
Please see the images below. Any help is appreciated. Thank you


