Hacker News new | ask | show | jobs
by inglor 3667 days ago
Nice project!

We have a project like that one of our developers wrote except it will compile the classes back to a CSS stylesheet for you for performance and will unify identical styles to not have duplicates and save space https://github.com/Mosho1/react-style

2 comments

One advantage to keep the style not in a CSS file is that you can handle dynamic value easily withing your component. Bringing back to a CSS file make you loss that capability.
So it translates everything back to CSS, is that how it handles hover and pseudo classes?
Yes, exactly - it also produces smaller file sizes and in our experience it's faster.

It's also nice to be able to use classes and integrate with CSS seamlessly when you need to.

Is it possible to use state or props in the CSS though? How does it handle that? Say I wanted the color of a title to be controlled via props, how would I do that with your solution?