Return mapped data in fetch, or map in components?
Which do you prefer and why? Alternatively, what are the use cases for each?
type SomeData = {id: string, name: string}
async function SomeFunction(): Promise<SomeData[]> {
const data = await fetch('/somewhere')
const json = await data.json()
return json.map(Mapper)
}
function SomeComponent(props: { data: SomeData[] }) {
// whatever
}