I am not at all a front-end developper. But isn't jQuery the DOM API done right? [Which is a good thing, but only the beginning of the journey.]
$('.my-component div').css({ background: 'yellow' })
vs. Array.from(document.querySelectorAll('.my-component div')).map(node => {
node.style.background = 'yellow';
})As for simple/readable it’s the same code but s/map/forEach.
forEach is much more indicative of what you're actually doing here, which is running through an iterable and mutating properties on each node.
Simple rule of thumb: if you're not using the results of `map`, you shouldn't be using it.
document.querySelectorAll('.my-component div').forEach(node => node.style.background = 'yellow');
https://developer.mozilla.org/en-US/docs/Web/API/NodeList/fo...Another, bigger factor is that most modern frameworks use some form of templating and binding which means that you have less need to modify/interact with the DOM directly.