I need to have 2 sibling components, and 1 of them should have a link to another - is this possible?
I tried this:
<button ref="btn">ok</button>
<PopupComponent triggerButton={this.refs.btn} />
And even that
<button ref="btn">ok</button>
<PopupComponent getTriggerButton={() => this.refs.btn} />
But I get undefinedin both situations. Any ideas?
Note: the parent component will not work for me, because I need to have several sets of them, for example
<button />
<PopupComponent />
<button />
<PopupComponent />
<button />
<PopupComponent />
I do not like:
<div>
<button />
<PopupComponent />
</div>
<div>
<button />
<PopupComponent />
</div>
<div>
<button />
<PopupComponent />
</div>
source
share