You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can this be a solid replacement to styled components?
How would this work with dynamic styling based on props similar to styled-components? Also can you update the docs with a section that talks about migrating from styled-components?
The text was updated successfully, but these errors were encountered:
I've managed to replace our styled-components / emotion usage with Navita - so it's definitely possible.
The dynamic nature of styled-components makes it very flexible. I've been thinking about this a lot when building Navita, and what I eventually would like to do is to build a complementary package that makes transitioning from styled-components easier.
I mentioned it briefly under "the future" on the documentation site.
It would abstract away whats possible today, and give users an easier API. I'm still thinking about how this would work, but it's something I would like to get in at some point. I'm working on a new evaluator that uses static analysis as much as possible and only evaluates js whenever it's strictly needed. This evaluator will ensure that we always generate as little CSS as possible.
Generally, I would try to stay away from dynamic styles, and only reach for it when absolutely necessary. For things like active style, you can compose styles with the runtime merge()-helper. You can see an example of that here.
However, the way I have approached dynamic styles is with CSS variables. Here's an example.
Can this be a solid replacement to styled components?
How would this work with dynamic styling based on props similar to styled-components? Also can you update the docs with a section that talks about migrating from styled-components?
The text was updated successfully, but these errors were encountered: