2016-04-07 26 views
1

bu taş kullanmaya çalışıyorum: npmbileşeni ithalat tanınmayan tepki

npm install react-component-gallery 

kullanılarak

http://kyleamathews.github.io/react-component-gallery/

Ben de yüklü Ve ben böyle bir tepki bileşeni yarattı:

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/[email protected]" /> 
     <img src="https://storage.googleapis.com/relaterocket-logos/[email protected]" /> 
    </ComponentGallery> 
    ); 
    } 

}); 

Ancak bu hatayı alıyorum:

JSX value should be either an expression or a quoted JSX t 
ext (10:11) 

hat 10 şudur Nerede:

margin=10 

Bunun nedeni nedir?

cevap

1

JSX XML benzeridir. Özellik değerleriniz alıntılanmış dizeler, ifadeler veya diğer JSX öğeleri olmalıdır. Senin durumunda, ör.

margin="10" 
noMarginBottomOnLastRow={true} 

(ikinci "true", sadece bir ifadenin bir örnek vererek olabilir.)

İlgili konular