by picaso · 4y ago · 0 comments
Anyway, I just think it is cool kind of for the same reason it is misleading :)
You can do a loop like:
for (let i = 0; i < 100; i++) {
const { cool } = divs;
cool.innerText = new Date();
document.body.append(cool);
}
and cool is actually a new div each time, even though you would think it was the same cool from divs (divs.cool). It also caches the div, so it is faster than even if you wrote the manual version with createElement.I could get rid of it, because my other approach to element creation would is:
const cool = div({ className: 'cool' });
which isn't too bad, but when I have a lot of divs, it is just nicer to do: const {
root,
headingContainer,
userContainer } = divs;
Also, yeah, it actually creates hyphened classes. so headingContainer goes to .heading-container. That is just how I work and so it is a convention.No comments yet.