I struggled for a while to get my nested map function to work only to discover that what
you return
is critical. Make sure you are returning the second map itself and not just the final expected output:
let { categories } = data;
categories = categories.map(category =>
category.subcategories.map((subcategory, i) => {subcategory.name}
)
);
return (
);