【发布时间】:2020-07-12 02:52:57
【问题描述】:
如果我将 CSS 作为字符串获取,我试图了解如何在样式化组件中呈现 CSS? "background: red; color: green; display: flex"
通常我使用的是函数 renderThemeProperty
export declare const renderThemeProperty: (themePropName: string, styleName: string, force?: boolean | undefined) => ({ theme }: any) => string | any[];
export default styled.div`
${renderThemeProperty('backgroundColor', 'background-color')};
`
但在这种情况下,我不知道哪些属性会进入我的组件。我应该解析那个字符串吗?
【问题讨论】:
标签: javascript reactjs typescript styled-components