Echo JS 0.11.0

<~>
tracker1 1638 days ago. link 2 points
Would be better to use the DOM classList[1] API, which is already available on all major browsers for a couple generations now (limited support in IE).

I will say, if you're using React, this is a bit lighter than the classnames[2] module, which would be my own preference.  However, knowledge of Array methods (map, reduce, etc) can accomplish the same without an external dependency, or the runtime wrapping likely to happen.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

[2] https://www.npmjs.com/package/classnames

Note: not the one who downvoted.

Replies

troy-tae 1637 days ago. link 1 point
I think this module's role is different with classList.
As you said, classList is a API of DOM.
But this module just generates a string.
So... I think this module is useful for framework or library user(React, Angular, Vue)
In VanillaJS, absolutely classList is good :)

And no worries, I'm not care about the downvote.
All of positive or negative opinions always welcome!