DEV Community

Discussion on: Use this trick to map over single objects in Javascript

Collapse
 
arikaturika profile image
Arika O • Edited

True, but how do you know if the response from the server has one object inside or an array of objects? You'll need to use different rendering methods (use map or not) depending on what you get from the fetch - so you would still need to make a check somewhere.