React dom 中使用变量
img 中的src要使用变量item2,但是上述代码的结果不符合预期.
注意:tag中使用变量时,不要加双引号.
正确的应该是:
return ( <div className="drtails-img-box"> <img src={item2} alt="" /> </div>); });
参考:
https://facebook.github.io/react/docs/dom-differences.html
https://facebook.github.io/react/docs/tags-and-attributes.html