[英]React component import not recognized
I am trying to use this gem:我正在尝试使用这个宝石:
http://kyleamathews.github.io/react-component-gallery/ http://kyleamathews.github.io/react-component-gallery/
So I installed it using npm
所以我使用
npm
安装了它
npm install react-component-gallery
And I created a React component like this:我创建了一个这样的 React 组件:
var Gallery = React.createClass({
render: function() {
return (
<ComponentGallery
className="example"
margin=10
noMarginBottomOnLastRow=true
widthHeightRatio=3/5
targetWidth=250>
<img src="https://example.com/pic1.jpg" />
<img src="https://example.com/pic2.jpg" />
<img src="https://example.com/pic3.jpg" />
<img src="https://example.com/pic4.jpg" />
<img src="https://example.com/pic5.jpg" />
<img src="https://example.com/pic6.jpg" />
<img src="https://storage.googleapis.com/relaterocket-logos/nike.com-black@2x.png" />
<img src="https://storage.googleapis.com/relaterocket-logos/gopro.com-black@2x.png" />
</ComponentGallery>
);
}
});
However I am getting this error:但是我收到此错误:
JSX value should be either an expression or a quoted JSX t
ext (10:11)
Where line 10 is this:第 10 行是这样的:
margin=10
Why is this occurring?为什么会出现这种情况?
JSX is XML-like. JSX 类似于 XML。 Your attribute values need to be quoted strings, expressions, or other JSX elements.
您的属性值需要是带引号的字符串、表达式或其他 JSX 元素。 In your case, eg
在你的情况下,例如
margin="10"
noMarginBottomOnLastRow={true}
(The second could be "true"
, just giving an example of an expression.) (第二个可能是
"true"
,只是给出一个表达式的例子。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.