Skip to content

Emotion vs styled components  #2

@lishine

Description

@lishine

Would you please mention, what do you mean by

Why Emotion?
You can swap that out with styled-components or whatever you like, it's just important to use some kind of CSS-in-JS solution so that everything follows from the JS module dependency graph. Keeps your app maintainable in the long run.

I personally like emotion because it lets you apply class names to vanilla HTML elements. React is all about composition: you build simple components, compose those into more complex components, compose those into even more complex components. But at the lowest level, down to the metal, you should be able to see and read what the HTML is. You should see the DIVs and SPANs. With styled-components for example you never do.

Do you mean the css={{}} property?
Do you like then the theme-ui sx property?
I use chackra-ui, they do not accept sx, so I have to use Box, Text etc. I have to use some framework for accessibility matters...
What I usually do is wrap the component with some meaningfull locally name like -Layout, then it is easy to reason about the component.

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