Emotion css 样式使用与示例相同的代码给我错误
Emotion css styled gives me error using same code as example
我正在尝试使用 Emotion.sh in my React test project butI get the following error using the same code as in example
需要考虑的可能有冲突的事项:
1、之前用的是npm,现在用的是yarn;
2. 我已经有一个小项目,我只更改了我的 App.js 以适应与示例完全相同的情况
3. 我对这一切都很陌生 =]
Andre,我认为你的问题与情绪使用的babel plugin有关。
没有 babel 插件,你的语法应该是这样的:
const Wrapper = styled('div')`
text-align: center;
`
使用 babel 插件,您可以使用您已经在使用的语法:
const Wrapper = styled.div`
text-align: center;
`
有关安装说明和 babel 配置,请参阅上面的 link。
我正在尝试使用 Emotion.sh in my React test project butI get the following error using the same code as in example
需要考虑的可能有冲突的事项: 1、之前用的是npm,现在用的是yarn; 2. 我已经有一个小项目,我只更改了我的 App.js 以适应与示例完全相同的情况 3. 我对这一切都很陌生 =]
Andre,我认为你的问题与情绪使用的babel plugin有关。
没有 babel 插件,你的语法应该是这样的:
const Wrapper = styled('div')`
text-align: center;
`
使用 babel 插件,您可以使用您已经在使用的语法:
const Wrapper = styled.div`
text-align: center;
`
有关安装说明和 babel 配置,请参阅上面的 link。