3 ms·
1. No frameworks, but there's an `injectGlobal` escape hatch with styled-components that I use for a CSS reset. We're transitioning from a class-based approach
by SirHound 9y ago
1. No frameworks, but there's an `injectGlobal` escape hatch with styled-components that I use for a CSS reset. We're transitioning from a class-based approach and the two are working together quite neatly.
2. This hasn't been a problem. Most of the global styles are based on tags, and classes are already more specific. The legacy class-based stuff is all hash-based too, so there's been no conflicts.
So far I'm enjoying the component-based approach. Render functions look much cleaner and you abstract logic that might have previously looked like
classnames(styles.btn, {
[styles.active]: isActive
})
to
({ isActive }) => `background: red`
Which lives in a totally different file.
On one hand I don't think I've done enough to reuse styles across components but on the other hand I know I'm never loading styles that aren't used specifically for the current render.