DEV Community

Discussion on: What is the standard way to keep UI state and backend state synced during updates? (React and Node)

Collapse
 
jamesjulius profile image
james-julius • Edited

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);
}
}