I wonder if the <div /> element created by the <CSSX /> wrapper is actually needed. Right now we are forcing an interference in the tree of elements descendants of the wrapper. It could create problems and break some things, making it harder to migrate from a different solution to react-cssx.
I understand that React is not very friendly when we try to create "transparent wrappers", but I have seen solutions that managed to do it well, not leaving any trace of their existence in the DOM. E.g. react-container-dimensions.
I also understand that right now there is a need to have a wrapper in order to prepend all the css rules with an id selector (e.g. #cssx-el-2 p). However, I believe that it could be replaced by attribute selectors, setting a given attribute (e.g. <p data-cssx="el-2" />) to all the top children inside the wrapper.
Any thoughts on that? I would like to hear the community and the author's opinion before I consider a PR to address this.
I wonder if the
<div />element created by the<CSSX />wrapper is actually needed. Right now we are forcing an interference in the tree of elements descendants of the wrapper. It could create problems and break some things, making it harder to migrate from a different solution toreact-cssx.I understand that React is not very friendly when we try to create "transparent wrappers", but I have seen solutions that managed to do it well, not leaving any trace of their existence in the DOM. E.g. react-container-dimensions.
I also understand that right now there is a need to have a wrapper in order to prepend all the css rules with an id selector (e.g.
#cssx-el-2 p). However, I believe that it could be replaced by attribute selectors, setting a given attribute (e.g.<p data-cssx="el-2" />) to all the top children inside the wrapper.Any thoughts on that? I would like to hear the community and the author's opinion before I consider a PR to address this.