警告文字的意外字符串连接

时间:2019-03-11 18:31:11

标签: css gatsby

我遇到与内联样式背景图片有关的多个警告。使用React-static我没有问题,但是现在有了Gatsby,我遇到了这个错误:

  

警告文字的意外字符串连接

如果我只想使用内联样式,该如何编码?任何建议都会有所帮助。

现在,我正在导入背景图像并使用嵌入式样式。我宁愿导入图像并使用内联样式,而不是创建多个CSS样式。

代码:

import Background from '../img/background.gif';


<div id="hero" className="header-banner" style={{background: 'url(' + `${Background}` + ')'}}></div>

0 个答案:

没有答案