我正在尝试在 react 组件(使用 create react app 创建)中使用 styled-jsx 库。
但我得到了错误:
styled-jsx/css:如果您收到此错误,则表示您的
css
标记模板文字没有被转译。
我不确定如何解决它,或者无法使用这个用于反应组件的库(这是我第一次使用它)。
import React from 'react';
import css from 'styled-jsx/css'
// import './styles';
export default function MyComponent(props) {
return (
<>
<div key={props.value}>{props.label}</div>
<style jsx>{button}</style>
</>
)
}
const button = css`div { color: hotpink; }`
非常感谢!