高级前端
css
【Q185】谈谈你对 styled-component 的看法

谈谈你对 styled-component 的看法

Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 186 (opens in a new tab)

Author 回答者: shfshanyue (opens in a new tab)

最为流行的 CSS-in-JS 方案

Author 回答者: leeleoo (opens in a new tab)

优点: 可维护性高, 易读性好, 可抽象, 可扩展性好。

缺点: runtime 对性能有一定的影响。 不能直接用postcss

生态:

twin.macos tailwind

babel-plugin-styled-components (opens in a new tab)  解决 className是名随机字符串的问题

typescript-styled-components-px2rem (opens in a new tab)