Fork me on GitHub
#helix
<
2021-05-05
>
dominicm16:05:49

https://reactjs.org/docs/web-components.html#using-web-components-in-react > One common confusion is that Web Components use “class” instead of “className”. Does helix handle this, or do I have to do some funk? Not actually using web components, just curious.

teh0xqb19:05:34

From the Helix docs, I found that if I passed the :class prop into my components, it would automagically translate them to :className

teh0xqb19:05:02

See “Other special props:” subsection

teh0xqb19:05:19

In practice, it was working until I integrated with a library that clones an element or does some more complex interaction. Then, :class was not properly replaced to :className until a second render, and I just decided to use :className as I’m anyways used to that on React (js) and don’t mind.

teh0xqb19:05:08

I suppose, to directly address your question: I don’t know if Helix transforms class to className in those scenarios (web components), or if it should.