我需要将一个简单的值从component A
传递到component B
,但是我不能使用道具,因为它没有使用父/子组件通信。
下面是一个更精确地说明我的 A组件的示例:
_redirect = () => {
// redirect to Component B
}
<button onClick={() => this._redirect()} >
<img src='http://source.com' alt='my_image' />
</button>
我想将alt
的值添加到组件B。
我该怎么做?