我想通过ImageText
组件中的道具传递两个参数。
我不确定它是正确的方法还是我必须创建一个映射然后传递它。传递多个道具到React组件
import React, { PropTypes, Component } from 'react'
const ImageText =() => (
<div className="img-with-text">
<img className="img" src={props.imageUrl} />
<p className="txt">{props.imageText}</p>
</div>
);
export default ImageText;
调用从另一个该组件如下
<ImageText imageUrl="/js.com" imageText="food"/>
但抛出的错误作为
Uncaught (in promise) ReferenceError: props is not defined
at ImageText
传递函数参数中的道具 –