Amazing insight. The only problem I have with storing data in an object is the inability to loop through the items in that object. Using methods like "map" becomes practically impossible for a react developer.
How about writing a custom function? I think something like this would work and would create a nice mini-optimisation to use objects as you're suggesting!
function mapObject(obj, callback) {
for (let [idx, val] in obj.entries()) {
callback(val, idx);
}
}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Amazing insight. The only problem I have with storing data in an object is the inability to loop through the items in that object. Using methods like "map" becomes practically impossible for a react developer.
You can get around the loop issue by converting the object to an array before/during render:
How about writing a custom function? I think something like this would work and would create a nice mini-optimisation to use objects as you're suggesting!
function mapObject(obj, callback) {
for (let [idx, val] in obj.entries()) {
callback(val, idx);
}
}