Skip to content

Is the wrapper necessary? #5

@zvictor

Description

@zvictor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions